
/* === Конкурс: сноска «время по МСК» === */
.contest-tz-hint { display:inline-block; margin-left:.5rem; font-size:.78rem; color:var(--muted-foreground); opacity:.8; }
.contest-remain--big { color:#000 !important; font-weight:700; }
/* Ссылка «до завершения …» в посте конкурса — чёрная и жирная (видна на сером фоне) */
.contest-remain { color:#000 !important; font-weight:700; }

/* === Битва ботов: страница раунда — большой коллаж «бот vs бот» === */
.br-collage { margin: 0 0 14px; text-align: center; }
.br-collage-img {
    width: 100%;
    max-width: 520px;
    height: auto;
    border-radius: 12px;
    display: block;
    margin: 0 auto 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.br-collage-captions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    flex-wrap: wrap;
    font-size: .95rem;
}
.br-collage-captions .cap.a { color: var(--accent, #e6b450); font-weight: 700; }
.br-collage-captions .cap.b { color: var(--accent, #e6b450); font-weight: 700; }
.br-collage-captions .cap.vs { color: var(--muted-foreground, #9aa0a6); font-size: .8rem; }
/* Fallback: мелкие аватарки, если коллаж не сгенерирован */
.br-fighters { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-bottom: 8px; }
.br-fighters .br-fighter { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.br-fighters .br-fighter img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }
.br-fighters .br-vs { font-weight: 800; font-size: 1.4rem; color: var(--muted-foreground, #9aa0a6); }

/* === Движение/медали авторов недели === */
.best-move, .sidebar-move { font-size: 0.85rem; min-width: 22px; text-align: center; }
.best-move-up, .best-move-down { font-weight: 700; }
.best-move-up { color: #66bb6a; }
.best-move-down { color: #ef5350; }
.best-move-new {
    color: #fff;
    font-weight: 700;
    font-size: 0.62rem;
    line-height: 1;
    background: #1e88e5;        /* синий бейдж «new» */
    border-radius: 3px;
    padding: 2px 4px;
    display: inline-block;
    text-transform: lowercase;  /* страховка: пишем как есть, но не даём взвестись в верхний */
}
.best-move-eq { color: var(--text-muted, #aaa); }
.best-author-move { min-width: 30px; text-align: center; }
.best-author-medals { color: #ffb74d; font-size: 0.85rem; }
.sidebar-best-txt { display: inline-flex; align-items: center; gap: 6px; }


/* === Топ авторов недели (/best) === */
.best-hint { font-size: 0.8rem; color: var(--text-muted, #aaa); font-weight: normal; }
.best-authors-list { display: flex; flex-direction: column; gap: 6px; }
.best-author {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border: 1px solid var(--border,#e0e0e0);
    border-radius: 8px; background: rgba(0,0,0,0.02);
    text-decoration: none; color: var(--text,#222);
}
.best-author:hover { border-color: var(--primary, #2563eb); }
.best-author-rank { width: 20px; font-weight: 700; color: var(--text-muted, #999); text-align: center; }
.best-author-avatar img { border-radius: 50%; width: 32px; height: 32px; }
.best-author-name { flex: 1; font-size: 0.92rem; font-weight: 600; }
.best-author-un { color: var(--text-muted,#aaa); font-size: 0.78rem; font-weight: normal; }
.best-author-rating { color: #66bb6a; font-weight: 700; font-size: 0.95rem; }


/* === Сайдбар «Лучшее за неделю» — дизайн как у блока «Эфир» (без рамки/подложки) === */
.sidebar-best {
    margin: 0 0 12px 0;
    width: 100%;
    box-sizing: border-box;
}
.sidebar-best .sidebar-activity-header { margin-bottom: 2px; padding-top: 26px; padding-bottom: 35px; padding-left: 0; }
/* «Кто онлайн» — как было: 35px сверху и снизу */
.sidebar-online .sidebar-activity-header {
    padding-top: 35px;
    padding-bottom: 35px;
}
/* «Новички» — верх уменьшен на 9px (26px), низ как было (35px) */
.sidebar-newfaces .sidebar-activity-header {
    padding-top: 26px;
    padding-bottom: 35px;
}
.sidebar-activity-header {
    margin-top: 30px;
    padding-top: 10px;
    padding-bottom: 10px;
}
.sidebar-activity-header:first-child {
    margin-top: 0;
}
.sidebar-best-link { text-decoration: none; display: block; width: 100%; }
.sidebar-best .sidebar-best-item { padding: 5px 0; }
/* Пункт — как .activity-item: аватар слева, текст справа */
.sidebar-best-item {
    display: flex; gap: 8px; align-items: flex-start;
    padding: 5px 0; text-decoration: none; color: var(--text, #222);
    font-size: 0.80rem; line-height: 1.35; letter-spacing: -0.2px;
    border-radius: 6px;
    transition: background 0.1s;
}
.sidebar-best-item:hover { background: rgba(0,0,0,0.03); }
/* Бейдж позиции «Топ авторов (за сутки)» — та же 25px, что и аватар:
   левый край .sidebar-best-txt совпадает в обоих сайдбар-блоках */
.sidebar-best-badge {
    flex-shrink: 0;
    width: 25px; min-width: 25px; height: 25px;
    margin-top: 1px;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; color: var(--text, #222);
}
/* Аватар победителя 25×25 круглый (как .notif-avatar в «Эфире») */
.sidebar-best-item .best-avatar {
    flex-shrink: 0;
    width: 25px; height: 25px;
    margin-top: 1px;
}
.sidebar-best-item .best-avatar img,
.sidebar-best-item .best-avatar .avatar-letter {
    width: 25px; height: 25px; border-radius: 50%;
    font-size: 0.7rem; object-fit: cover;
}
/* Текстовая часть: юзернейм сверху, подпись-ссылка ниже */
.sidebar-best-txt {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
/* Аватар + юзернейм на одном уровне: аватар слева, юзернейм справа, текст под юзернеймом */
.sidebar-best-user-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}
/* Колонка с юзернеймом и подписью "лучший пост/комментарий": текст слева вровень с юзернеймом */
.sidebar-best-user-data {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
/* Ссылка-аватар на аккаунт */
.sidebar-best-user-avatar {
    display: inline-block;
    line-height: 0;
    text-decoration: none;
}
.sidebar-best-user-avatar .newface-avatar,
.sidebar-best-user-avatar img {
    display: block;
}
/* Юзернейм — как в «Эфире» (.notif-userlink: жирный 700, цвет текста, без акцентного цвета) */
.sidebar-best-user-nick {
    font-size: 0.80rem;
    font-weight: 700;
    color: var(--text, #222);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    text-decoration: none;
}
.sidebar-best-user-nick:hover { text-decoration: underline; }
/* Текст "лучший пост/комментарий" — под юзернеймом, выровнен по левому краю юзернейма */
.sidebar-best-text {
    font-size: 0.72rem;
    color: var(--accent, #2563eb);
    display: block;
    cursor: pointer;
}
.sidebar-best-text:hover { text-decoration: underline; }

/* 24.08: в блоках «Лучшее за неделю» и «Топ авторов» текст внутри
   .sidebar-best-txt по левому краю (перекрывает align-items:center из
   строки 21, которое центрировало ники/подписи/рейтинг горизонтально) */
.sidebar-best .sidebar-best-txt { align-items: flex-start; }

/* 24.08: в «Топ авторов» никнеймы жирные, как в «Эфире» (.notif-userlink font-weight:700);
   и цветом текста (без акцентного цвета ссылок) */
.sidebar-best-authors .sidebar-best-txt { font-weight: 700; }
.sidebar-best-authors .sidebar-best-txt { color: var(--text, #222); }

/* Сайдбар «Популярное у автора» на странице поста — та же карточка, текст переносимый */
.sidebar-author-best {
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border, #e0e0e0);
    border-radius: var(--radius, 10px);
    padding: 12px;
    margin-bottom: 12px;
}
.sidebar-author-best .sidebar-best-item { align-items: flex-start; }
.sidebar-author-best .sidebar-best-txt {
    flex: 1;
    min-width: 0;
    display: block;
    white-space: normal;
    overflow-wrap: break-word;
}
.sidebar-author-best .sidebar-author-rate {
    color: #66bb6a; font-weight: 700; margin-left: 6px; font-size: 0.8rem;
}
/* Мета-строка под пунктом: кол-во комментариев + рейтинг */
.sidebar-author-best .sidebar-best-txt { flex-direction: column; }
.sidebar-author-best .sidebar-best-meta {
    display: flex; align-items: center; gap: 8px;
    margin-top: 3px;
    font-size: 0.75rem;
    color: #9aa0a6;
}
.sidebar-author-best .meta-cmts { color: #9aa0a6; }
.sidebar-author-best .meta-cmts svg { vertical-align: -2px; }
.sidebar-author-best .sidebar-best-meta .sidebar-author-rate { margin-left: 0; }

/* ========================================
   Дневничок — Mobile-first CSS
   ======================================== */

:root {
    --bg: #ffffff;
    --bg-card: #ffffff;
    --text: #222222;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #e0e0e0;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --warning: #f59e0b;
    --rating-positive: #16a34a;
    --rating-negative: #dc2626;
    --rating-neutral: #666666;
    --header-bg: #1e3a8a;
    --footer-bg: #f8f8f8;
    --online: #22c55e;
    --comment-guest-bg: #f9f9f9;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --radius: 8px;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Noto Color Emoji', 'Segoe UI Emoji', 'Apple Color Emoji', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* Container */
.container {
    max-width: 1290px;
    margin: 0 auto;
    padding: 0 16px;
    overflow-x: hidden;
}

/* Страница поста — шире, почти на всю ширину экрана с широкими отступами по краям */
/* Повышена специфичность (.container.container--wide), чтобы перебить
   позднее правило `.container { max-width: 1200px }` в media-запросах ниже. */
.container.container--wide {
    max-width: calc(100vw - 72px);
    padding: 0 36px;
}
@media (max-width: 768px) {
    /* 24.08: на мобиле время эфира как было */
    .activity-item .activity-time {
        font-size: 0.68rem;
    }
    .container.container--wide {
        max-width: 100%;
        padding: 0 16px;
    }
}

/* Two-column layout */

/* === Удалённый аккаунт: скрыть сайдбар и развернуть контент по центру === */

/* === Лучшее за неделю (звёзды) === */
.best-star {
    font-size: 1rem;
    cursor: default;
    vertical-align: middle;
    margin-left: 4px;
}
.best-star-post { color: #f5c514; }
.best-star-comment { color: #f5c514; }

.author-stars-block {
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border, #e0e0e0);
    border-radius: var(--radius, 10px);
    padding: 14px 16px;
    margin-bottom: 16px;
}
.author-stars-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--text);
}
.author-stars-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.author-star {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(0,0,0,0.03);
    text-decoration: none;
    color: var(--text, #222);
    font-size: 0.9rem;
}
.author-star:hover { background: rgba(0,0,0,0.06); }
.author-star-ico { position: relative; color: #ff8c00; font-size: 1.1rem; }
.author-star-txt { color: var(--text-muted, #999); }

/* Счётчик-кружочек в углу медали/звезды */
.profile-medal { position: relative; }
.medal-ico { position: relative; display: inline-block; }
.count-badge {
    position: absolute;
    top: -7px;
    right: -9px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--accent, #e0245e);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    box-sizing: border-box;
    box-shadow: 0 0 0 2px var(--bg-card, #1c1c1c);
    pointer-events: none;
}


/* Сайдбар «Лучшее» */
.best-sidebar {}

.content-sidebar.sidebar-hidden { display: none; }
.content-layout:has(.content-sidebar.sidebar-hidden) .content-main {
    flex: 1 1 100%;
    max-width: 100%;
}
.content-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.content-main {
    flex: 1 1 auto;            /* растёт, чтобы сайдбар прижался к правому краю шапки */
    min-width: 0;
    background: #ffffff;
    border-radius: 8px;
    min-height: 300px;
}
.content-sidebar {
    flex: 0 0 calc(22% - 12px + 100px);   /* золотое сечение: левый 57.6% × 0.382 ≈ 22% */
    background: #ffffff;
    border-radius: 8px;
    min-height: 400px;
    position: sticky;
    color: #222;
}
/* Красный блок вверху правой колонки */
.sidebar-red-block {
    width: 100%;
    background: #ef4444;
    border-radius: 8px;
    height: 60px;
    margin-bottom: 12px;
}
.content-sidebar--post {
    background: #dbeafe;
}
@media (max-width: 768px) {
    .content-sidebar { display: none; }
    .content-layout { display: block; }
    .content-main { flex: none; width: auto; }
}

/* Header */
.site-header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
/* Тёмно-синяя шапка: светлые текст/лого/ссылки для читаемости */
.site-header { border-bottom-color: rgba(255,255,255,.12); }
.site-header .logo { color: #fff; }
.site-header .logo:hover { color: #cbd5e1; }
.site-header .site-nav a:not(.btn) { color: #e2e8f0; }
.site-header .site-nav a:not(.btn):hover { color: #fff; }
.site-header .site-nav .user-link { color: #e2e8f0; }
.site-header .notif-bell { color: #ffffff; }
.site-header .nav-online-btn,
.site-header .nav-chat-btn { color: #e2e8f0; border-color: rgba(255,255,255,.35); }
.site-header .nav-online-btn:hover,
.site-header .nav-chat-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.site-header .header-user { color: #fff; }

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    display: inline-flex;
    align-items: center;   /* иконка и надпись на одной горизонтальной оси */
    gap: 3px;              /* надпись почти вплотную к логотипу */
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}
.logo-img {
    width: 29px;
    height: 29px;
    flex: 0 0 auto;
    border-radius: 6px;
    display: block;
    object-fit: contain;
}
.logo:hover {
    text-decoration: none;
    color: var(--primary);
}
.logo-label {
    display: block;
    line-height: 1;      /* отвязать от наследуемого межстрочного, чтобы текст не создавал лишний верт. зазор */
    transform: none;     /* убрать ручной translateY(-4px): на разных шрифтах/браузерах/моб он давал плавающий сдвиг */
}
.header-brand {
    display: inline-flex;
    flex-direction: column;   /* логотип сверху, счётчик под ним */
    align-items: flex-start;  /* выровнено к левому краю логотипа */
    gap: 2px;
    min-width: 0;
}
.site-stats {
    font-size: 0.6rem;        /* уменьшенный шрифт под логотипом */
    color: var(--text-muted, #9aa);
    white-space: nowrap;
    line-height: 1;
}
.site-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.site-nav .user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}
.site-nav .user-link {
    font-weight: 500;
}

/* Header avatar + dropdown */
.header-user {
    position: relative;
}

.header-avatar-wrapper {
    cursor: pointer;
    display: flex;
    align-items: center;
}
.header-avatar-wrapper:hover {
    opacity: 0.85;
}
.header-dropdown hr {
    margin: 0;
    border: none;
    border-top: 1px solid var(--border);
}
.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--text);
    font-size: 0.9rem;
    text-decoration: none;
}
.dropdown-item:hover {
    background: var(--bg);
    text-decoration: none;
}

/* Letter avatars (Google-style) */
.avatar-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: uppercase;
    user-select: none;
}
.avatar-letter-lg {
    width: 64px;
    height: 64px;
    font-size: 1.6rem;
}

/* Notification bell */
.notif-wrapper {
    position: relative;
    display: inline-block;
}
.notif-bell {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
    position: relative;
    border-radius: var(--radius);
    /* Никаких фоновых эффектов при наведении/нажатии/фокусе (просьба 14.09.26):
       колокольчик не должен «заливаться» серым/белым при клике и тапе.
         - transition убран: он и создавал видимое «проявление» фона;
         - -webkit-tap-highlight-color: серая вспышка по тапу на мобиле (iOS/Android);
         - appearance: none убирает нативную подсветку кнопки. */
    transition: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
}
/* Колокольчик уведомлений — белый на всех страницах */
.notif-wrapper .notif-bell {
    color: #ffffff;
}

/* ==== Лёгкое плавное увеличение колокольчика при наведении (просьба 14.09.26) ====
   Масштабируем ТОЛЬКО иконку (SVG), а не кнопку: кнопка position: relative и держит
   бейдж-счётчик (.notif-count) абсолютом — при scale на кнопке бейдж уезжал бы вместе
   с ней и «прыгал».
   ⚠ Используем свойство scale, а НЕ transform: у .notif-bell-ico на мобиле уже есть
   transform: translateY(3px) (сдвиг иконки вниз). Свойство transform в правиле :hover
   перебило бы тот сдвиг и иконка дёргалась бы вверх. Свойство scale складывается
   с transform независимо — оба работают одновременно.
   Величина 1.06 — «очень лёгкое»: 34px -> 36px. */
.notif-bell-ico {
    transform-origin: center;
    transition: scale .18s ease;
}
.notif-bell:hover .notif-bell-ico {
    scale: 1.06;
}
/* На тач-устройствах hover «залипает» после тапа — увеличение там не нужно вовсе. */
@media (hover: none) {
    .notif-bell:hover .notif-bell-ico {
        scale: none;
    }
}
/* Фон при наведении УБРАН (был background: var(--bg) = белый — на тёмной шапке
   это выглядело как светлое пятно, а на тач-устройствах hover «залипал» после клика).
   Эффект при клике не нужен вовсе — по просьбе. */
.notif-bell:hover,
.notif-bell:focus,
.notif-bell:active {
    background: none;
    outline: none;
}
/* Фокус с клавиатуры всё же показываем — иначе не видно, где находишься при
   навигации табом. Это НЕ подсветка клика: :focus-visible срабатывает только
   при управлении с клавиатуры. */
.notif-bell:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.75);
    outline-offset: 2px;
}
.notif-count {
    position: absolute;
    top: 1px;
    right: 4px; /* сдвинут на 5 влево от исходного right:-1px */
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 18px;
    padding: 0 4px;
    border-radius: 50%; /* круглый бейдж */
    display: block;
    text-align: center;
    line-height: 18px; /* == высоте бейджа → цифра строго по центру кружка */
    pointer-events: none;
}
/* Светло-зелёный кружок, когда среди непрочитанных есть личное сообщение (ЛС). Решение 30.08.26. */
.notif-count.notif-count-pm {
    background: #7ed957;
}
.notif-modal {
    /* Раньше 580px хватало: внутри был только список уведомлений.
       Теперь одна из закладок — переписка с колонкой аватарок слева.
       Саму ширину задаём в @media ниже: общее правило .modal-popup
       (min-width:768px) { width:570px } идёт ПОЗЖЕ этого блока и перебило бы
       width такой же специфичности. */
    max-width: 720px;
}
.profile-modal {
    max-width: 320px;
}
/* Меню юзера (#profile-dropdown): ссылки чёрные */
#profile-dropdown a,
.profile-modal a {
    color: #000;
}
/* Меню юзера: прокрутка, если пункты не влезают по высоте экрана (нижние иначе не видны) */
#profile-dropdown {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
#profile-dropdown .modal-header {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-card);
}
#profile-dropdown .modal-footer {
    padding-bottom: 30px; /* отступ снизу после «Выход» */
}

/* Modal popup shared styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
}
/* Лёгкое плавное появление модалок в стиле iOS (только transform/opacity — GPU-ускорено, без JS) */
@keyframes modalIosIn {
    0%   { opacity: 0; transform: translate(-50%, calc(-50% + 20px)) scale(0.96); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.modal-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 380px;
    max-width: 90vw;
    max-height: 80vh;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIosIn 0.22s ease-out;
    -webkit-animation: modalIosIn 0.22s ease-out;
    will-change: auto;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 1rem;
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-secondary);
    line-height: 1;
}
.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
}
.modal-sep {
    color: var(--text-muted);
}
.modal-toggle-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.modal-toggle-link:hover {
    text-decoration: underline;
}

/* Предупреждение гостю перед отправкой комментария (см. comments.js → showGuestWarn) */
.guest-warn-popup {
    width: 400px;
}
.guest-warn-body {
    padding: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
}
.guest-warn-body b {
    color: var(--text);
}
.guest-warn-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px 16px;
    flex-wrap: wrap;
}
.guest-warn-actions .btn {
    flex: 1 1 auto;
    text-align: center;
    justify-content: center;
}

/* Подтверждение «Перейти в ЛС» (см. comments.js → pmInviteConfirm) */
.pm-invite-confirm-bd {
    display: flex;
    align-items: center;
    justify-content: center;
}
.pm-invite-confirm {
    width: 440px;
    max-width: calc(100vw - 32px);
}
.pm-invite-confirm-body {
    padding: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
}
.pm-invite-confirm-body b {
    color: var(--text);
}
.pm-invite-confirm-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px 16px;
    flex-wrap: wrap;
}
.pm-invite-confirm-actions .btn {
    flex: 1 1 auto;
    text-align: center;
    justify-content: center;
}

/* Приглашение из ЦУ: модалка «Принять / Отказаться» (см. notifications.js) */
.pm-invite-choice-bd {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;   /* выше окна ЦУ */
}
.pm-invite-choice {
    width: 440px;
    max-width: calc(100vw - 32px);
}
.pm-invite-choice-body {
    padding: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
}
.pm-invite-choice-body b {
    color: var(--text);
}
.pm-invite-choice-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px 16px;
    flex-wrap: wrap;
}
.pm-invite-choice-actions .btn {
    flex: 1 1 auto;
    text-align: center;
    justify-content: center;
}
.logout-item {
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
}
.logout-item:hover {
    color: #dc2626;
    text-decoration: underline;
}
.profile-modal hr {
    margin: 0;
    border: none;
    border-top: 1px solid var(--border);
}
.dropdown-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
}
.dropdown-nickname {
    font-weight: 600;
    font-size: 0.95rem;
}
.dropdown-username {
    font-size: 0.8rem;
    color: #000;
}
.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.1s;
}
.dropdown-item:hover {
    background: var(--bg);
}
.avatar-letter-lg {
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
}
.notif-list {
    max-height: 400px;
    overflow-y: auto;
}
.notif-item {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}
.notif-item:hover {
    background: var(--bg);
}
.notif-item:last-child {
    border-bottom: none;
}
.notif-unread {
    background: var(--primary-light);
}
.notif-unread:hover {
    background: #dbeafe;
}
/* Личные сообщения (type='pm') в списке уведомлений — выделяем всю строку бледно-салатовым.
   Перекрывает и нейтральный фон, и голубую подсветку непрочитанных (.notif-unread),
   чтобы ЛС всегда читались в зелёной гамме (в тон салатовому бейджу #7ed957). 02.09.26. */
.notif-list .notif-item.notif-item-pm,
#notif-dropdown .notif-item.notif-item-pm {
    background: #ecf9e7;
}
.notif-list .notif-item.notif-item-pm.notif-unread,
#notif-dropdown .notif-item.notif-item-pm.notif-unread {
    background: #d8f2cd;
}
.notif-list .notif-item.notif-item-pm:hover,
#notif-dropdown .notif-item.notif-item-pm:hover {
    background: #e1f6d7;
}
.notif-list .notif-item.notif-item-pm.notif-unread:hover,
#notif-dropdown .notif-item.notif-item-pm.notif-unread:hover {
    background: #ceebc0;
}
/* «Новый пост» автора, на которого юзер подписался (type='new_post') — светло-кремовый #FFFDEA.
   Только на СВЕЖИХ (непрочитанных) строках. Когда просмотрено (.notif-unread снят) — фон белый:
   нижестоящее правило классу фона не задаёт. 07.09.26. */
.notif-list .notif-item.notif-item-newpost.notif-unread,
#notif-dropdown .notif-item.notif-item-newpost.notif-unread {
    background: #FFFDEA;
}
.notif-list .notif-item.notif-item-newpost.notif-unread:hover,
#notif-dropdown .notif-item.notif-item-newpost.notif-unread:hover {
    background: #fbf6cf;
}
.notif-avatar {
    flex-shrink: 0;
}
.notif-content {
    flex: 1;
    min-width: 0;
}
.notif-text {
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.4;
}
.notif-link {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}
.notif-link:hover {
    text-decoration: underline;
}
/* Все ссылки в окне уведомлений — синие (гарантированно, перекрывает любые каскады) */
.notif-modal a,
.notif-list a,
#notif-dropdown a { color: var(--primary); }
.notif-spy {
    font-size: 0.75rem;
    opacity: 0.75;
    margin-left: 3px;
    vertical-align: middle;
    cursor: default;
    white-space: nowrap;
}
.notif-userlink {
    font-weight: 700;
}
/* 24.08: в эфире ники чёрные (без акцентного цвета ссылок) */
.activity-item .notif-userlink,
.activity-item a.notif-userlink {
    color: var(--text);
}
/* Счётчик непрочитанных ЛС в сгруппированной строке ЦУ */
/* Подсказка/кнопка подгрузки списка ЦУ */
.notif-more-hint {
    padding: 8px 12px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    cursor: pointer;
    user-select: none;
}
.notif-more-hint:hover { color: var(--text, #222); }
.notif-pm-count {
    display: inline-block;
    min-width: 16px;
    padding: 0 5px;
    margin-left: 2px;
    border-radius: 8px;
    background: var(--accent, #2f3033);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 16px;
    text-align: center;
    vertical-align: middle;
}
.notif-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.notif-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.notif-mark-all {
    font-size: 0.85rem;
    cursor: pointer;
}

/* Main */
.site-main {
    min-height: calc(100vh - 120px);
    padding: 20px 0;
    overflow-x: hidden;
}

/* Footer */
.site-footer {
    background: var(--footer-bg);
    border-top: 1px solid var(--border);
    padding: 16px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    font-family: inherit;
}
.btn:hover {
    background: #f0f0f0;
    text-decoration: none;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-hover);
}
.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
}
.btn-sm {
    padding: 4px 10px;
    font-size: 0.85rem;
}
.btn-block {
    width: 100%;
}
.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--text-muted);
    border-radius: var(--radius);
}
.btn-icon:hover {
    background: var(--bg);
    color: var(--text);
}
/* Иконка «три точки» в модалке поста (фрагмент) — +50% к базовому .btn-icon */
.tile-menu-btn { font-size: 1.8rem; }
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.15s;
    font-family: inherit;
}
.btn-action:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}
.btn-action.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-action .count {
    font-weight: 500;
    color: var(--text);
}
/* Кол-во НОВЫХ комментариев в скобках рядом со счётчиком */
.btn-action .count-new {
    color: var(--primary);
    font-weight: 700;
    white-space: nowrap;
}
.btn-action-sm {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px 8px;
    border: none;
    border-radius: var(--radius);
    background: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: inherit;
}
.btn-action-sm:hover {
    color: var(--text);
    background: var(--bg);
}
.btn-action-sm.active {
    color: var(--primary);
}
.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 0;
    font-family: inherit;
    text-decoration: none;
}
.btn-link:hover {
    text-decoration: underline;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 0.95rem;
}
.form-group small {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2px;
}
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-card);
    transition: border-color 0.15s;
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.radio-group label {
    font-weight: 400;
    cursor: pointer;
}
.radio-group input {
    margin-right: 6px;
}
.form-errors {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 16px;
}
.form-errors .error {
    color: var(--danger);
    font-size: 0.9rem;
}

/* Auth pages */
.auth-page {
    max-width: 400px;
    margin: 0 auto;
    padding: 40px 16px;
}
.auth-page h1 {
    text-align: center;
    margin-bottom: 24px;
}
.auth-switch {
    text-align: center;
    margin-top: 16px;
    color: var(--text-muted);
}
.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}
.auth-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}

/* Post card */
.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.post-card .post-header,
.post-full .post-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    position: relative;
}
/* Аватар и мета (ник + время) — рядом по горизонтали (справа от аватара) */
.post-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.post-header .post-author-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
    white-space: nowrap;
}
.post-header .post-author-username {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.post-header .post-rating {
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
}
.post-header .post-rating.positive { color: var(--rating-positive); }
.post-header .post-rating.negative { color: var(--rating-negative); }
.post-header .post-rating.neutral { color: var(--rating-neutral); }
.post-footer .post-rating {
    margin-left: auto;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    cursor: default;
}
.post-footer .post-rating.positive { color: var(--rating-positive); }
.post-footer .post-rating.negative { color: var(--rating-negative); }
.post-footer .post-rating.neutral { color: var(--rating-neutral); }
.post-header .post-time {
    font-size: 0.625rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.post-header .post-stat {
    font-size: 0.675rem;
    color: var(--text-muted);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    line-height: 1;
    margin-left: 6px;
}
.post-header .post-stat svg.icon {
    width: 12px;
    height: 12px;
    vertical-align: middle;
}
.post-time .post-stat-inline {
    font-size: 0.625rem;
    color: var(--text-muted);
    margin-left: 6px;
    white-space: nowrap;
}
.post-stat-inline svg.icon {
    width: 4px;
    height: 4px;
    vertical-align: -6px;
}
/* Никнейм автора + дата под ним (вертикальная колонка) */
.post-author-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}
.post-author-meta .post-time {
    margin-left: 0;
    font-size: 0.625rem;
}
/* Правая группа шапки поста (просмотры + рейтинг) — на одной оси с никнеймом/временем, прижата вправо */
.post-header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.post-header-right .post-stat.post-header-view {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 0;
}
.post-header-right .post-stat.post-header-view svg.icon {
    width: 15px;
    height: 15px;
    margin: 0;
    vertical-align: middle;
}
/* Меню «три точки» в шапке поста — на одной линии с ником/просмотрами/рейтингом,
   пробел 30px от рейтинга до триточек */
.post-header-right .post-menu-btn-right {
    margin-left: 30px;
    flex-shrink: 0;
}
.edited-icon {
    font-size: 0.75rem;
    cursor: default;
    opacity: 0.6;
    margin-left: 4px;
}

.post-stat {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Collapsible post content */
.post-content-collapsible {
    overflow: hidden;
    /* Показываем целиком. Сжатие >500px применяет .is-collapsed (на клиенте). */
    max-height: none;
    transition: max-height 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.post-content-collapsible.is-collapsed {
    max-height: var(--clamp-h, 900px);
}

/* Кнопка «Раскрыть пост» (появляется, когда контент обрезан по высоте). Кнопка идёт ПОСЛЕ
   последней обрезанной строки, с чистым отступом (не наезжает на строку). */
.post-expand-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 16px 0 4px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--accent, #7c6cf0);
    border-radius: 18px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    transition: background 0.2s, color 0.2s;
}
.post-expand-btn:hover {
    background: var(--bg);
}
.post-expand-btn-icon {
    transition: transform 0.3s ease;
    font-size: 0.8rem;
}
.post-expand-btn.is-open .post-expand-btn-icon {
    transform: rotate(180deg);
}


/* Post menu */
.post-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    min-width: 200px;
    z-index: 50;
    padding: 4px 0;
}
.post-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    font-family: inherit;
}
.post-menu button:hover {
    background: rgba(0,0,0,0.05);
}
.post-menu hr {
    margin: 4px 0;
    border: none;
    border-top: 1px solid var(--border);
}

/* Post body */
.post-body {
    margin-bottom: 12px;
    overflow: hidden;
}

.post-rating-badge {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}
.post-rating-badge.positive { background: #16a34a; }
.post-rating-badge.negative { background: #dc2626; }
.post-rating-badge.neutral  { background: #6b7280; }

/* Рейтинг + просмотры под временем написания поста (в post-author-meta) */
.post-meta-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    order: 2;   /* всегда после ник/времени (на мобильных .post-time order:1) */
}
.post-meta-stats .post-rating-badge {
    margin-left: 0;
    padding: 1px 5px;
    font-size: 0.56rem;   /* −30% от 0.8rem, «иконка рейтинга» крупнее не нужна */
}
.post-meta-stats .post-stat.post-header-view {
    margin-left: 0;
    font-size: 0.625rem;
}
.post-meta-stats .post-stat.post-header-view svg.icon {
    width: 13px;
    height: 13px;
}

/* Заголовок поста в ленте (кликабельный — разворачивает пост) */
.post-title-link {
    display: block;
    color: var(--text);
    font-size: calc(1.15rem - 1px);   /* заголовок поста в ленте, уменьшен на 1px */
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 70px;
    text-decoration: none;
}
.post-title-link:hover {
    color: var(--primary);
    text-decoration: none;
}

/* Превью первых строк поста в ленте (max 3 строки, обрезка + многоточие) */
.post-preview {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 12px;
    text-decoration: none;
    cursor: pointer;
}
.post-preview:hover {
    text-decoration: none;
}

/* Post title (full post page) */
.post-title {
    font-size: calc(1.4rem - 1px);   /* уменьшен на 1px */
    font-weight: 800;
    margin-bottom: 40px;
    letter-spacing: -0.04em;
}
/* Просмотры — в правом конце заголовка (flex, не вылезают за границы) */
.post-title,
.post-title-link,
body.feed-home .feed-page .post-card .post-title-link {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.post-title,
body.post-page .post-title,
.post-title-link,
body.feed-home .feed-page .post-card .post-title-link { margin-bottom: 30px; }  /* = отступу аватарка->заголовок */
.post-title .post-title-stat,
.post-title-link .post-title-stat,
body.feed-home .feed-page .post-card .post-title-link .post-title-stat {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 0.8rem;
    font-weight: 400;            /* не болд */
    color: #9aa0a6;              /* бледнее */
    white-space: nowrap;
}
.post-title .post-title-stat svg,
.post-title-link .post-title-stat svg {
    color: #9aa0a6;
    vertical-align: -11px;   /* -5px базово, опустил на 6px ниже */
}
.post-title a {
    color: var(--text);
}
.post-text {
    font-size: 1rem;
    line-height: 1.30;
    word-wrap: break-word;
}
/* Абзацы постов: базовый отступ между абзацами убран (0). «Воздух» между абзацами
   обычных юзеров даёт сам пустой абзац из Quill (<p><br></p>) — это ровно одна строка,
   «как в блокноте». У постов ботов (cron_bot_posting.php) абзацы идут подряд без пустых
   <p><br></p>, поэтому им отступ оставляем — иначе абзацы слиплись бы встык. */
.post-text p { margin-bottom: 0; }
/* ===== Списки в тексте постов и комментариев =====
   Разметка зависит от источника:
     • Quill (редактор на сайте) отдаёт <ol><li data-list="bullet|ordered"> —
       признак маркера лежит в атрибуте, тег у обоих видов списков <ol>;
     • markdown/ручной HTML может дать обычные <ul>/<ol>.
   Поэтому покрываем оба варианта.

   Отступы кратны базовому ритму текста: слева 24px (кратно 12px — паддингу
   пузыря и отступам .post-text), между пунктами 4px — тот же зазор, что у
   строк текста. Маркер вынесен наружу (outside), чтобы текст пункта
   выравнивался по тексту абзацев, а не «уезжал» вправо. */
.post-text ul,
.post-text ol {
    margin: 8px 0;
    padding-left: 24px;
    list-style-position: outside;
}
.post-text li {
    margin: 4px 0;
}
/* Обычные списки (markdown / вставленный HTML) */
.post-text ul { list-style-type: disc; }
.post-text ol { list-style-type: decimal; }
/* Вложенные уровни: кружок, затем квадрат — как принято в тексте */
.post-text ul ul { list-style-type: circle; }
.post-text ul ul ul { list-style-type: square; }

/* Списки от Quill: тег ВСЕГДА <ol>, а вид задаёт data-list.
   Маркер НЕ отключаем: list-style-type: none с последующим ::marker требует
   ручного счётчика, и любая ошибка в нём даёт «1. 1. 1.» вместо нумерации.
   Задаём вид маркера напрямую — тогда встроенный счётчик браузера работает
   штатно, без нашей арифметики. */
.post-text ol:has(> li[data-list]) { list-style-type: none; }
.post-text li[data-list="bullet"] { list-style-type: disc; }
.post-text li[data-list="ordered"] { list-style-type: decimal; }
.post-text p:empty { margin-bottom: 0; }                        /* пустой параграф (без <br>) не даёт воздуха */
.post-text p:has(> br:only-child) { margin-bottom: 0; line-height: 1.30; }  /* пустой абзац = ровно одна строка */
.post-text--bot-log p { margin-bottom: 40px; }
.post-text p:has(img) {
    margin-top: 25px;
    margin-bottom: 25px;
}
/* Фото в постах: во всю ширину поста, высота ограничена 500px (превью), по клику — полное */
.post-text img {
    width: 100%;
    max-width: 100%;
    max-height: 500px;
    height: auto;
    object-fit: cover;
    object-position: 50% 25%; /* кадрировать ближе к верху (3/4 от верхней кромки), не по центру */
    display: block;
    margin: 25px 0 !important;
    border-radius: 8px;
    cursor: pointer;
}
.comment-body img {
    width: 500px;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 25px 0 !important;
    border-radius: 8px;
    cursor: pointer;
}
/* Загруженные видео в постах: во всю ширину поста, высота ограничена 400px */
.post-text video {
    width: 100%;
    max-width: 100%;
    max-height: 400px;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 12px 0;
    border-radius: 8px;
}

/* === Водяной знак «Д» (логотип Дневничка) поверх ЗАГРУЖЕННЫХ видео ===
   Обёртку создаёт JS (main.js → brandUploadedVideos). Только для uploads/videos,
   внешние iframe-встраивания не трогаем. Логотип не перехватывает клики. */
.dnk-video {
    position: relative;
    display: block;
    line-height: 0;                 /* убираем нижний зазор под видео */
}
.dnk-video video {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0;                     /* отступы отдельно у контекста-родителя (см. ниже) */
    line-height: normal;
}
/* Логотип в правом верхнем углу: заглавная «Д» белым на чёрном круге.
   Без теней, без наклона; шрифт как в заголовках (inherit, жирный 700). */
.dnk-logo {
    position: absolute;
    top: 10px;
    right: 14px;
    z-index: 2;
    pointer-events: none;          /* клики проходят сквозь к логотипу → не мешаем плееру */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;                   /* размер чёрного круга */
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.72);
    font-family: inherit;
    font-weight: 700;              /* как в заголовках */
    font-style: normal;
    font-size: 27px;
    line-height: 1;
    color: #fff;
    user-select: none;
}
/* Постам логотип зримо, но корректно по углам; в ленте не мешает кнопкам.
   Комментарии: видео само задаёт width:500px/margin:8px 0 (каскадно ниже),
   поэтому обёртке там margin не задаём, чтобы не удваивать вертикальный отступ. */
.post-text .dnk-video { margin: 12px 0; }
/* На планшетах/телефонах логотип чуть меньше, чтобы не закрывать контролы */
@media (max-width: 600px) {
    .dnk-logo {
        top: 6px;
        right: 8px;
        width: 34px;
        height: 34px;
        font-size: 20px;
    }
}

/* Загруженные аудио (mp3) в постах: компактный плеер на всю ширину */
.post-text audio {
    width: 100%;
    max-width: 100%;
    display: block;
    margin: 12px 0;
}
@media (max-width: 600px) {
    .post-text img, .comment-body img {
        width: 100%;
        margin: 12px 0 !important;
    }
}
/* Импортированные видео то LJ (lj-embed) — сетрили как картинки/видео: центр, ширина 500px, 16:9 */
.post-text .lj-embed, .comment-body .lj-embed {
    width: 500px;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    display: block;
    margin: 12px auto;
    border: none;
    border-radius: 4px;
}
@media (max-width: 600px) {
    .post-text .lj-embed, .comment-body .lj-embed {
        width: 100%;
        margin: 8px auto;
    }
}
.post-text blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 12px;
    color: var(--text-secondary);
    margin: 8px 0;
}
.post-text pre {
    background: #f0f0f0;
    border-radius: var(--radius);
    padding: 12px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.4;
}
.post-text code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
.post-text pre code {
    background: none;
    padding: 0;
}
.post-text .hashtag {
    color: var(--primary);
    font-weight: 500;
}
.post-text .mention {
    color: var(--primary);
    font-weight: 500;
}

/* Post footer */
.post-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.post-footer .views {
    cursor: default;
    border-color: transparent;
}
.post-footer .views:hover {
    background: var(--bg-card);
}
.post-section-link {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--primary, #2563eb);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}
.post-section-link:hover {
    text-decoration: underline;
}
.post-privacy-icon {
    margin-left: 4px;
    font-size: 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.post-privacy-icon:hover {
    background: var(--bg);
    color: var(--text);
}
.profile-sections-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.profile-sections-picker label {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.profile-sections-picker select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
}
.section-picker select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    box-sizing: border-box;
}
/* Выпадающие меню в форме создания поста (видимость, комментарии) — тек же, что раздел */
.form-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    box-sizing: border-box;
}
.new-section-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.new-section-row input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--bg-card);
    color: var(--text);
}

/* Post gallery — каскад как в iPhone */
.gallery-stack {
    position: relative;
    margin: 8px 0;
    cursor: pointer;
    min-height: 250px;
    overflow: hidden;
}
.gallery-stack .gallery-item {
    position: absolute;
    top: 0;
    left: 50%;
    transform-origin: center center;
    width: 35%;
    margin-left: -17%;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(0,0,0,0.12);
    transition: transform 0.3s ease;
    background: #fff;
}
.gallery-stack .gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gallery-stack:hover .gallery-item {
    transform: none !important;
}
.gallery-stack:hover .gallery-item:nth-child(2) {
    transform: rotate(-1deg) translateY(-4px) !important;
}
.gallery-stack:hover .gallery-item:nth-child(3) {
    transform: rotate(1deg) translateY(-8px) !important;
}

/* Одна картинка — без каскада */
.gallery-stack[data-total="1"] .gallery-item {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    left: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* СЕТКА 3 в ряд (решение юзера 30.08.26): плитки, клик → лайтбокс с навигацией.
   Переопределяет каскадное absolute-позиционирование .gallery-stack. */
.gallery-stack.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    min-height: 0;
    overflow: visible;
    padding-bottom: 0; /* НЕ наследовать каскадный padding-bottom:75% из мобильного
                          media (.gallery-stack) — иначе под сеткой пустое место ~пол-экрана */
    margin-top: 35px; /* отступ над галереей (решение юзера 30.08.26) */
    margin-bottom: 8px;
}
.gallery-stack.gallery-grid .gallery-item {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    margin-left: 0;
    border-radius: 8px;
    box-shadow: none;
    aspect-ratio: 1 / 1;
    background: #000;
}
.gallery-stack.gallery-grid .gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.gallery-stack.gallery-grid:hover .gallery-item {
    transform: none !important;
}

/* Превью-галерея в форме создания поста: плитки 3 в ряд */
.post-gallery-upload {
    margin-top: 8px;
}
.post-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.post-gallery-grid .pg-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}
.post-gallery-grid .pg-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.post-gallery-grid .pg-item .pg-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
}

/* Мобильные */
@media (max-width: 480px) {
    .gallery-stack {
        padding-bottom: 75%; /* чуть выше на мобильных */
    }
    .gallery-stack .gallery-item {
        width: 50%;
        margin-left: -25%;
    }
    /* Одна картинка — каскадный padding не нужен: иначе под портретным фото
       остаётся огромное пустое место (75% ширины) после картинки на мобильном */
    .gallery-stack[data-total="1"] {
        padding-bottom: 0;
    }
    .gallery-stack[data-total="1"] .gallery-item {
        width: 100%;
        margin-left: 0;
    }
}

/* Post video */
.post-video {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    margin: 12px 0;
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 200px;
}
.post-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Video inside comments — iframe-плееры: фикс, чтобы высота соответствовала ширине (16:9),
   а не padding-bottom, который берёт процент от родителя (даёт черную вытянутую полосу) */
.comment-body .post-video {
    width: 500px;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    padding-bottom: 0;
    height: auto;
    min-height: 0;
}

/* Avatars */
.avatar {
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg);
}
.avatar-32 { width: 42px; height: 42px; }
.avatar-64 { width: 64px; height: 64px; }
.avatar-96 { width: 96px; height: 96px; }
.avatar-128 { width: 128px; height: 128px; }
/* Аватарка на странице юзера — квадратная как в ленте (со скруглением 16px) */
.profile-page .profile-avatar-section .avatar { border-radius: 16px; }
/* Превью аватара в кабинете редактирования — прямоугольное, как на странице юзера */
.edit-profile-page #avatar-preview { border-radius: 16px; }
.avatar-wrapper {
    position: relative;
    display: inline-block;
}
.online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--online);
    border: 2px solid var(--bg-card);
    border-radius: 50%;
}
.online-dot.large {
    width: 20px;
    height: 20px;
    bottom: 4px;
    right: 4px;
}

/* Profile */

/* === Удалённый аккаунт (deleted_at) === */
.account-deleted-notice {
    color: var(--text-muted);
}
.profile-page .avatar-deleted img,
.avatar-deleted img,
img.avatar-deleted,
.user-avatar-deleted img {
    opacity: 0.35 !important;
    filter: grayscale(1);
}
.profile-nickname.is-deleted {
    color: var(--text-muted) !important;
    text-decoration: line-through;
    opacity: 0.7;
}
.is-deleted-user {
    color: var(--text-muted) !important;
    opacity: 0.6;
}
.post-author-name.is-deleted-user,
.comment-author .is-deleted-user,
.sidebar-newfaces .is-deleted-user {
    color: var(--text-muted) !important;
    opacity: 0.6;
}


.profile-page {
    padding: 16px 0;
}
.profile-header-owner {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}
.profile-avatar-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}
.profile-middle {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.profile-info {
    flex: 1;
}
.profile-nickname {
    font-size: 1.5rem;
    line-height: 1.1;
    letter-spacing: -0.015em;
    margin-bottom: 2px;
}
.profile-username {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

/* Блок «Рейтинг» справа от никнейма (прижат к правому краю) + иконки симпатии/антипатии */
.profile-rating-side {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-shrink: 0;
}
.profile-rating-badge {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}
.profile-rating-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.profile-rating-value {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1;
}
.profile-rating-value.positive { color: #16a34a; }
.profile-rating-value.negative { color: #dc2626; }
.profile-rating-votes {
    display: flex;
    align-items: center;
    gap: 6px;
}
.vote-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
    transition: transform 0.15s, background 0.2s;
}
.vote-btn:hover {
    transform: scale(1.1);
    background: var(--bg);
}
.vote-sympathy:hover { border-color: #16a34a; }
.vote-antipathy:hover { border-color: #dc2626; }
@media (max-width: 480px) {
    .profile-rating-side {
        width: 100%;
        justify-content: flex-start;
        margin-left: 0;
        flex-wrap: wrap;
    }
}

/* Кнопка ⋯ и выпадающее меню действий в профиле */
.profile-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.profile-name-row .profile-nickname {
    margin-bottom: 0;
}
.profile-menu-wrap {
    position: relative;
    display: inline-block;
}
.profile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(127,127,127,0.15);   /* еле заметный серый фон под точками */
    color: var(--text-muted);
    font-size: 1.95rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.profile-menu-btn:hover {
    background: rgba(127,127,127,0.28);
    color: var(--text);
}
.profile-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 60;
    min-width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius, 10px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    padding: 6px 0;
}
.profile-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.92rem;
    color: var(--text);
    font-family: inherit;
    white-space: nowrap;
}
.profile-menu-item:hover {
    background: var(--bg);
}
.profile-menu-item.is-danger {
    color: var(--rating-negative, #dc2626);
}
.profile-menu-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
@media (max-width: 480px) {
    .profile-menu {
        position: fixed;
        right: 12px;
        left: 12px;
        top: auto;
    }
}
.profile-about,
.profile-location,
.profile-interests,
.profile-age {
    margin-bottom: 4px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.profile-last-visit {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}
/* «Последний визит: сейчас» — когда юзер/бот в блоке «Кто онлайн» */
.profile-last-visit-online {
    color: var(--online);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}
.profile-last-visit-online .profile-last-visit-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--online);
    display: inline-block;
    flex-shrink: 0;
}
.profile-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}
.stat-value {
    font-weight: 700;
    font-size: 1.1rem;
}
.profile-rating {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 6px;
    font-weight: 700;
    color: #fff;
    font-size: 1.1rem;
}
.profile-rating.positive { background: #16a34a; }
.profile-rating.negative { background: #dc2626; }
.profile-rating.neutral { background: #9ca3af; }
/* Рейтинг в блоке статистики — справа, вплотную к границе блока */
.profile-stats-rating { margin-left: auto; text-align: center; }
.profile-stats-rating .profile-rating { display: inline-block; margin-bottom: 4px; }
/* Движение рейтинга за неделю: зелёный плюс / красный минус */
.week-delta.positive { color: #16a34a; }
.week-delta.negative { color: #dc2626; }
.btn-danger {
    background: #dc2626;
    color: #fff;
    border: none;
}
.btn-danger:hover {
    background: #b91c1c;
}
.btn-warning {
    background: #d97706;
    color: #fff;
    border: none;
}
.btn-warning:hover {
    background: #b45309;
}
/* Admin: ban badges & actions */
.profile-medal {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
    font-size: 1.1rem;
    line-height: 1;
    cursor: default;
}
.ban-badge {
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
}
.ban-badge--full { background: #dc2626; }
.ban-badge--half { background: #d97706; }
.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 8px;
}
.admin-label {
    font-weight: 700;
    font-size: 0.85rem;
    color: #92400e;
}
.admin-sep {
    color: #b45309;
    opacity: 0.6;
    font-weight: 600;
}
.admin-bot-attack {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
    user-select: none;
}
.admin-bot-attack:hover {
    background: rgba(146, 64, 14, 0.08);
}
.bot-attack-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #92400e;
    white-space: nowrap;
}
.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.profile-actions {
    margin-bottom: 16px;
}
/* Кнопки под аватаркой на странице юзера — шириной = аватарке (128px), колонкой */
.profile-actions--avatar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 128px;
    margin-top: 12px;
    margin-bottom: 0;
}
.profile-actions--avatar .btn {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding-top: 8px;
    padding-bottom: 8px;
}
.profile-feed {
    margin-top: 16px;
}
.profile-feed h2 {
    margin-bottom: 12px;
}

/* Edit profile */
.edit-profile-page {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
}
.edit-profile-page h1 {
    margin-bottom: 20px;
}
.edit-avatar-section {
    text-align: center;
    margin-bottom: 24px;
}
.edit-avatar-section .avatar {
    margin-bottom: 8px;
}
.edit-avatar-section .help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Мини-редактор аватара (сдвиг/масштаб/обрезка) */
.avatar-crop-panel {
    max-width: 300px;
    margin: 12px auto 8px;
    padding: 12px;
    background: var(--bg-elevated, #fff);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-align: center;
}
.avatar-crop-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    background: #111;
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.avatar-crop-viewport:active {
    cursor: grabbing;
}
.avatar-crop-canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: auto;
}
.avatar-crop-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(to right, transparent calc(50% - 1px), rgba(255,255,255,.5) calc(50% - 1px), rgba(255,255,255,.5) calc(50% + 1px), transparent calc(50% + 1px)),
        linear-gradient(to bottom, transparent calc(50% - 1px), rgba(255,255,255,.5) calc(50% - 1px), rgba(255,255,255,.5) calc(50% + 1px), transparent calc(50% + 1px));
}
.avatar-crop-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 10px 0 8px;
}
.avatar-crop-controls .btn-sm {
    min-width: 34px;
    font-size: 1rem;
    line-height: 1;
}
.avatar-crop-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 6px;
}
.avatar-crop-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.avatar-crop-actions .btn {
    flex: 1;
}
.avatar-crop-msg {
    margin-top: 8px;
    font-weight: 600;
}
.avatar-crop-msg-warn {
    color: var(--warning, #f0ad4e);
}
.avatar-crop-msg-err {
    color: var(--danger, #e55);
}

/* Create post */
.create-post-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
}
/* Editor buttons row */
.editor-buttons {
    display: flex;
    gap: 8px;
    padding: 8px;
}
.editor-buttons .btn {
    font-size: 0.85rem;
    cursor: pointer;
}
.gallery-editor-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    padding: 4px 10px;
    font-size: 0.85rem;
    cursor: default;
    user-select: none;
    font-weight: 500;
}
.gallery-bar {
    padding: 6px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-top: none;
    border-bottom: none;
}
/* Rich text editor */
.rich-editor {
    min-height: 200px;
    padding: 12px;
    border: none;
    border-radius: var(--radius) var(--radius) 0 0;
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg-card);
    outline: none;
    word-wrap: break-word;
    overflow-y: auto;
}
.rich-editor:empty::before {
    content: attr(placeholder);
    color: #999;
    pointer-events: none;
}
.drop-zone {
    padding: 16px;
    border-top: 1px dashed var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: background 0.15s;
}
.drop-zone.dragover {
    background: var(--primary-light);
    border-color: var(--primary);
}
.drop-zone .btn-link {
    cursor: pointer;
}

/* Comments */
.comments-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 0;
    margin-top: 20px;
    overflow-x: hidden;
}
/* Страница поста: блок ВЫВОДА комментариев — во всю ширину сайта (контент+сайдбар+gap). Форма ввода — суженная. */
body.post-page .comments-section,
body.post-page .comments-tree {
    width: 100%;
    max-width: 100%;
}
/* Форма комментария на странице поста — шириной = левой колонке (как линия-разделитель под постом) */
body.post-page .comment-form-wrap {
    width: calc(100% - (22% - 12px + 100px) - 126px);   /* = ширине .content-main / линии-разделителю под постом */
    max-width: calc(100% - (22% - 12px + 100px) - 126px);
}
body.post-page .comment-form {
    width: 100%;
    max-width: 100%;
}
@media (max-width: 768px) {
    body.post-page .comments-section { width: 100%; }
    body.post-page .comment-form-wrap,
    body.post-page .comment-form { width: 100%; max-width: 100%; }
}
.comments-section h2 {
    margin-bottom: 16px;
    font-size: 1.1rem;
}
.comment-form {
    margin-bottom: 100px;
}
.comment-form textarea {
    margin-bottom: 8px;
    min-height: 60px;
}
.comment-form-upload {
    display: flex;
    align-items: center;
    gap: 8px;
    /* margin-bottom убран: единый отступ до кнопки задаёт .comment-form .btn-primary,
       чтобы зазор был одинаковым для юзера и гостя */
}
/* Кнопка «Отправить»: единый отступ от поля(загрузки) для юзера и гостя */
.comment-form .btn-primary {
    margin-top: 10px;
}
.comment-form-img-preview {
    display: inline-block;
    vertical-align: middle;
}
.upload-dots span {
    animation: dotBounce 1.2s infinite;
    font-size: 1.2rem;
    font-weight: 700;
    color: #999;
    display: inline-block;
}
.upload-dots span:nth-child(2) { animation-delay: 0.2s; }
.upload-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-4px); opacity: 1; }
}
.comment {
    margin-bottom: 20px;
}
/* Ответы на комментарии (вложенные любой глубины) — тот же вертикальный пробел, что и у корневых */
.comment-replies .comment {
    margin-bottom: 20px;
}
.comment .comment-header {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}
.comment-author {
    display: flex;
    align-items: center;
    gap: 8px;
}
/* Никнейм + дата/время — в столбик (дата под никнеймом) */
.comment-author-name-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    min-width: 0;
}
.comment-author-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}
.comment-guest-name {
    color: var(--text-muted);
    font-style: italic;
}
.comment-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.2;
}
/* Ник + шильдик «автор» в одну строку (шильдик справа от никнейма, на одной оси по базовой линии) */
.comment-author-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
}
.comment-author-badge {
    display: inline-block;
    padding: 0 4px;              /* в 3 раза меньше */
    margin-left: 4px;
    background: var(--primary, #2563eb);
    color: #fff;
    font-size: 0.46rem;          /* 0.23rem × 2 — шильдик «автор» */
    font-weight: 700;
    line-height: 1.35;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    vertical-align: middle;
    cursor: default;
    white-space: nowrap;
}
/* Шильдик «бот» — видимый только админу (гостебот-1 #124 комментит под гостевым псевдонимом).
   Серая плашка — не путать с синей «автор» (выше). */
.comment-author-badge.bot-badge {
    background: #6b7280;
}
/* Шильдик «бот» у АВТОРА поста в шапке (лента/страница поста/модалка) — видно только админу.
   Серая плашка, чуть крупнее комментарийной (рядом с крупным ником). */
.post-author-badge.bot-badge {
    display: inline-block;
    padding: 0 6px;
    margin-left: 6px;
    background: #6b7280;
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    line-height: 1.5;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    vertical-align: middle;
    cursor: default;
    white-space: nowrap;
}
/* Шильдик «Битва ботов» на странице конкурса-ББ: тот же каркас, что у «автор»,
   но выделенный цветом (фиолетовый акцент), чтобы не путать с синей «автор». */
.comment-author-badge.battle-badge-bb {
    background: #7c3aed;
}
.comment-modal .modal-footer .btn-primary {
    width: 100%;
}
.comment-rating {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 5px;
    margin-left: 6px;
    color: #fff;
    line-height: 1.4;
}
.comment-rating.positive { background: #16a34a; }
.comment-rating.negative { background: #dc2626; }
/* Toast notification */
.toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #16a34a;
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast-error {
    background: #dc2626;
}
/* Exclusions page */
.exclusions-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}
.exclusions-section {
    margin-bottom: 24px;
}
.exclusions-section h2 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}
.exclusions-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
}
.exclusions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.exclusions-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.exclusions-user {
    display: flex;
    align-items: center;
    gap: 8px;
}
.exclusions-name {
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--text);
}
.exclusions-name:hover {
    text-decoration: underline;
}
.exclusions-username {
    font-size: 0.8rem;
    color: var(--text-muted);
}
/* Settings page */
.settings-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}
.settings-form {
    margin-top: 16px;
}
.settings-section {
    margin-bottom: 20px;
}
.settings-section h2 {
    font-size: 1.05rem;
    margin-bottom: 10px;
}
/* Браузерные (Web Push) уведомления — кнопка статуса в настройках */
.settings-push-status {
    padding: 9px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
}
.settings-push-status + .btn {
    margin-left: 10px;
}
/* Раскрывающаяся инструкция «Как включить на Mac/iPhone» под кнопкой пуша */
.push-help {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    padding: 2px 14px;
}
.push-help summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.92rem;
    padding: 10px 0;
    color: var(--text);
    list-style-position: outside;
}
.push-help summary:hover {
    color: var(--primary, #3498db);
}
.push-help-body {
    border-top: 1px solid var(--border);
    padding: 12px 0 14px;
    font-size: 0.9rem;
    line-height: 1.5;
}
.push-help-body h3 {
    font-size: 0.98rem;
    margin: 12px 0 6px;
}
.push-help-body ol {
    margin: 0 0 6px;
    padding-left: 20px;
}
.push-help-body li {
    margin-bottom: 6px;
}
.push-help-body .settings-hint {
    margin-top: 0;
}
.settings-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
}
.settings-toggle .toggle-switch {
    flex-shrink: 0;
}
.settings-field {
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.settings-label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: var(--text);
}
.settings-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 10px;
}
/* Строка события: основной тумблер + чекбокс «на почту» справа в один ряд */
.settings-toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.settings-toggle-row .settings-toggle-main {
    flex: 1;
}
.settings-email-check {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.settings-email-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent, #9BCE00);
    cursor: pointer;
    margin: 0;
}
#notif-email {
    width: 100%;
    max-width: 320px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
}
.settings-email-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
#notif-email-save {
    margin-left: 8px;
    font-size: 0.85rem;
}
.privacy-slider {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
}
.privacy-opt {
    flex: 1;
    padding: 7px 10px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.privacy-opt:hover {
    color: var(--text);
}
.privacy-opt.active {
    background: var(--primary, #2563eb);
    color: #fff;
}
/* Настройки анкеты: подпись-пояснение под тумблером (второй строкой, мельче)
   и визуальное выделение опасного действия «Временно отключить анкету». */
/* Баннер «анкета временно отключена» — виден только владельцу отключённой анкеты. */
.account-disabled-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    max-width: 720px;
    margin: 0 auto 12px;
    padding: 10px 14px;
    border: 1px solid #e57373;
    border-radius: var(--radius, 8px);
    background: rgba(229, 115, 115, 0.08);
    color: var(--text, #e0e0e0);
    font-size: 0.9rem;
}
.account-disabled-link {
    color: #e57373;
    font-weight: 600;
    white-space: nowrap;
}
.settings-toggle-note {
    display: block;
    margin-top: 3px;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.4;
}
.settings-toggle--danger > span:first-child {
    color: #e57373;
}
.settings-toggle--danger .toggle-slider {
    border-color: #e57373;
}
/* Слайдер видимости профиля: три подписи длиннее, чем в остальных слайдерах,
   поэтому на узких экранах ужимаем кегль и паддинг вместо переноса строки. */
.privacy-slider--profile .privacy-opt {
    padding: 7px 8px;
}
@media (max-width: 480px) {
    .privacy-slider--profile .privacy-opt {
        padding: 7px 6px;
        font-size: 0.74rem;
    }
}
.sections-manage {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.section-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.section-row-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}
.section-row-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.btn-danger {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
    color: #fff !important;
}
.privacy-modal-wrap {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.privacy-modal {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border);
    border-radius: var(--radius, 14px);
    width: 100%;
    max-width: 360px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}
.privacy-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 0.95rem;
}
.privacy-modal-body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.privacy-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.privacy-row-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.privacy-row-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}
.privacy-modal-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}
.btn-block {
    width: 100%;
}
.alert-success {
    background: #dcfce7;
    color: #16a34a;
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    font-size: 0.9rem;
}
.comment-likes-static {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-right: 8px;
}
.c-like {
    color: #16a34a;
    font-weight: 700;
}
.c-dislike {
    color: #dc2626;
    font-weight: 700;
}
.comment-body {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 6px;
    word-wrap: break-word;
}
.comment-hidden-note {
    font-style: italic;
    color: var(--text-muted);
    display: block;
}
.comment-author-name {
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--text);
}
.comment-body p { margin-bottom: 0.3em; }
.comment-body p:has(img) {
    margin-top: 25px;
    margin-bottom: 25px;
}
.comment-body blockquote {
    border-left: 2px solid var(--primary);
    padding-left: 8px;
    color: var(--text-secondary);
    margin: 4px 0;
}
.comment-body code {
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.85em;
}
.comment-footer {
    display: flex;
    gap: 4px;
    align-items: center;
}
/* Меню действий комментария («три точки») — прижато к правому краю */
.comment-menu {
    position: relative;
}
/* Десктоп: меню («три точки») справа от ника с пробелом 100px */
@media (min-width: 769px) {
    .comment-menu {
        margin-left: 100px;
    }
}
/* Мобильных — меню по правому краю, на уровне ника; крупнее на 25% и поднято на 2px */
@media (max-width: 768px) {
    .comment-menu { margin-left: auto; }
    .comment-menu .comment-menu-btn.btn-action-sm {
        padding: 5px 7.5px;              /* +25% от 4px/6px */
        transform: translateY(-2px);     /* поднять на 2px */
    }
    .comment-menu .comment-menu-btn svg {
        width: 20px; height: 20px;       /* +25% от 16px */
    }
}
.comment-menu .comment-menu-btn {
    padding: 4px 6px;
}
.comment-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 150px;
    z-index: 500;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.14);
    padding: 4px;
    flex-direction: column;
}
.comment-menu-dropdown.open {
    display: flex;
}
.comment-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    background: none;
    border: none;
    border-radius: 7px;
    font-size: 0.88rem;
    color: var(--text);
    cursor: pointer;
    text-align: left;
}
.comment-menu-item:hover {
    background: var(--bg-hover, rgba(0,0,0,0.05));
}
.comment-menu-item.is-danger {
    color: var(--danger, #d33);
}
.comment-menu-item.is-danger:hover {
    background: rgba(221,51,51,0.1);
}
.comment-replies {
    margin-left: 20px;
    margin-top: 20px;
    padding-left: 8px;
}
/* Mobile — убираем линии ветвления */
@media (max-width: 480px) {
    .comment-replies {
        margin-left: 0;
        padding-left: 0;
    }
}
/* Кнопка перехода к родительскому комментарию — слева от ника, иконка 20×20 (share-forward), только на десктопах */
.comment-reply-to {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    cursor: pointer;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-right: 2px;
}
.comment-reply-to:hover {
    color: var(--primary);
}
.comment-guest .comment-body {
    color: var(--text-muted);
}
.comment-highlight {
    animation: commentFade 3s ease-out;
}
@keyframes commentFade {
    0%   { background: #fef9c3; }
    100% { background: transparent; }
}
.comment-content {
    border-radius: var(--radius);
}
.comment-reply-form {
    margin: 8px 0;
}
.comment-modal {
    max-width: 630px;
}
/* Десктоп: редактор ответа выше на 50% (140 → 210px), модалка растёт за ним. */
@media (min-width: 768px) {
    .comment-modal .editor-quill {
        min-height: 210px;
    }
}
.comment-modal-body {
    padding: 12px 16px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.comment-modal-body textarea {
    width: 100%;
    min-height: 300px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
}
@media (max-width: 480px) {
    .comment-modal {
        max-width: 90vw !important;
        width: 90vw;
    }
}
.comment-modal-body textarea:focus {
    border-color: var(--primary);
}
.comment-modal-upload {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.comment-reply-form textarea {
    min-height: 40px;
    font-size: 0.85rem;
}
.load-replies {
    margin-top: 4px;
    font-size: 0.8rem;
}

/* Закладки окна уведомлений: «Уведомления» | «Сообщения».
   Живут В ШАПКЕ окна, слева, вместо статичного заголовка; справа от них —
   шестерёнка переписки и «✕». Отступы кратны 8px, колонка аватарок 64px. */
.notif-header {
    /* Шапка держит закладки слева, а шестерёнку+«✕» справа: space-between
       развёл бы три группы, поэтому прижимаем правый край сам. */
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 12px;
}
.notif-header .modal-close {
    margin-left: 4px;
}
.notif-tabs {
    display: flex;
    gap: 4px;
    margin-right: auto;   /* закладки влево, шестерёнка и «✕» — вправо */
}
.notif-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: var(--text-muted, #888);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.notif-tab:hover { background: rgba(0,0,0,0.05); color: var(--text, #222); }
.notif-tab.is-active {
    background: var(--primary-light, #e8f0fe);
    color: var(--primary, #2563eb);
}
/* Кружки на закладках: обычный — голубой, непрочитанные ЛС — салатовый (#7ed957),
   в тон кружку колокольчика. */
.notif-tab-badge {
    min-width: 18px;
    padding: 1px 5px;
    border-radius: 9px;
    background: var(--primary, #2563eb);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
}
.notif-tab-badge--pm { background: #7ed957; color: #143d05; }
.notif-pane { display: flex; flex-direction: column; min-height: 0; }

/* Панель «Сообщения»: слева колонка аватарок, справа переписка. */
.notif-pane--msgs {
    flex: 1 1 auto;
    flex-direction: row;
    min-height: 0;
}
.pm-convo-rail {
    flex: 0 0 64px;
    border-right: 1px solid var(--border);
    background: var(--bg, #f7f7f8);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.pm-convo-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
}
.pm-convo-empty {
    padding: 16px 4px;
    color: var(--text-muted, #888);
    font-size: 0.72rem;
    text-align: center;
    line-height: 1.4;
}
.pm-convo-item {
    position: relative;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    flex: 0 0 auto;
}
.pm-convo-av {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: #666;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 0 0 2px transparent;
    transition: box-shadow 0.15s;
}
.pm-convo-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Активный собеседник — рамка вокруг аватарки */
.pm-convo-item.is-active .pm-convo-av { box-shadow: 0 0 0 2px var(--primary, #2563eb); }
.pm-convo-item:hover .pm-convo-av { box-shadow: 0 0 0 2px rgba(0,0,0,0.18); }
.pm-convo-item.is-active:hover .pm-convo-av { box-shadow: 0 0 0 2px var(--primary, #2563eb); }
/* Онлайн — точка в правом нижнем углу аватарки */
.pm-convo-av.is-online::after {
    content: '';
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--online, #22c55e);
    border: 2px solid var(--bg-card, #fff);
}
/* Непрочитанное: салатовая точка с числом, как кружок колокольчика */
.pm-convo-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: #7ed957;
    color: #143d05;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border: 2px solid var(--bg-card, #fff);
    box-sizing: content-box;
}
/* Правая часть: шапка собеседника + тред + поле ввода */
.pm-convo-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}
/* Полоса собеседника над перепиской УБРАНА (решение юзера 13.09.26):
   дублировала аватарку и ник, которые и так есть в ленте сверху, и съедала
   ~44px высоты на телефоне. Активный собеседник подсвечивается в ленте
   (.pm-convo-item.is-active). Элемент #pm-convo-head оставлен в разметке
   пустым — на нём висит #pm-title с data-nick/data-username, откуда берётся
   имя для подтверждения «Удалить переписку». */
.pm-convo-head {
    display: none;
}
/* Шестерёнка в шапке окна: выпадающее меню позиционируется от неё. */
.notif-header .pm-menu-wrap {
    margin-left: 0;   /* в панели переписки был margin-left:auto — в шапке не нужен */
}
/* В окне-закладке тред занимает всё свободное место (в отдельной модалке
   ограничивались 52vh — здесь окно и так ограничено max-height). */
.notif-modal .pm-body {
    max-height: none;
    min-height: 200px;
}
.notif-modal .pm-input-row { padding: 8px 12px; }

/* ===== Личные сообщения (ПМ) ===== */
.pm-modal {
    max-width: 460px;
}
.pm-title-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 8px;
}
.pm-title-name {
    color: var(--text, #222);
    font-weight: 600;
}
.pm-title-online-dot {
    position: static;
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: 6px;
    vertical-align: middle;
    border-radius: 50%;
    background: var(--online);
    border: 2px solid var(--bg-card);
}
/* Выпадающее меню шестерёнки в окне переписки */
.pm-menu-wrap {
    position: relative;
    margin-left: auto;
}
.pm-menu {
    /* position/top/left/max-height задаёт JS (pm.js: positionPmMenu):
       меню живёт в <body> и позиционируется fixed от кнопки-шестерёнки, иначе
       окно уведомлений (fixed + overflow:hidden) обрезало его хвост. */
    position: fixed;
    max-height: 60vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 1200;   /* выше окна уведомлений (.modal-popup z-index 1000) */
    min-width: 220px;
    padding: 4px;
    border: 1px solid var(--border, #e3e3e6);
    border-radius: 10px;
    background: var(--card, #fff);
    box-shadow: 0 6px 20px rgba(0,0,0,0.14);
    text-align: left;
}
.pm-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 7px 9px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    /* Все пункты меню — ЧЁРНЫЕ (решение юзера 13.09.26): без красных/цветных
       акцентов, единый вид списка. */
    color: #000;
    font-family: inherit;
    font-size: 0.86rem;
    text-align: left;
    cursor: pointer;
}
.pm-menu-item:hover { background: rgba(0,0,0,0.05); }
/* .is-danger больше не красит текст — оставлен как маркер в разметке,
   но визуально пункты одинаковые и чёрные. */
.pm-menu-item.is-danger { color: #000; }
.pm-menu-arrow { opacity: 0.6; font-size: 0.8rem; }
/* Подменю со звуками внутри меню */
/* Подменю со звуками: 9 пунктов в столбик давали ~302px и упирались в
   окно переписки (у .pm-modal max-height ~512px и overflow:hidden) —
   хвост списка срезался. Ограничиваем высоту и даём собственную прокрутку,
   тогда меню целиком помещается в окно. */
.pm-submenu {
    padding: 2px 0 4px 8px;
    /* Прокрутку даём самому меню (.pm-menu), а не подменю: иначе получались две
       вложенные прокрутки и «залипание» колеса на границе списка. Скроллить здесь
       не нужно — высоту ограничивает .pm-menu по свободному месту экрана. */
    overflow: visible;
    overscroll-behavior: auto;
}
.pm-submenu .pm-sound-item {
    padding: 4px 6px;
}
/* Иконка настроек уведомлений в шапке окна переписки (слева от «✕») */
.pm-gear-btn {
    margin-right: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-muted, #888);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    transition: color .15s ease, background .15s ease, transform .3s ease;
}
.pm-gear-btn:hover {
    color: var(--text, #222);
    background: rgba(0,0,0,0.05);
    transform: rotate(45deg);
}
/* Панель настроек звука */
.pm-settings {
    padding: 10px 16px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg, #f7f7f8);
}
.pm-settings-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text, #222);
    margin-bottom: 8px;
}
.pm-sound-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pm-sound-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.86rem;
    /* Чёрный — как и пункты меню (единый вид списка, решение 13.09.26). */
    color: #000;
}
.pm-sound-item:hover { background: rgba(0,0,0,0.04); }
.pm-sound-item.is-active { background: rgba(0,0,0,0.06); font-weight: 600; }
.pm-sound-item input[type="radio"] { margin: 0; flex-shrink: 0; }
.pm-sound-name { flex: 1 1 auto; }
.pm-sound-off-mark {
    font-size: 0.72rem;
    color: var(--text-muted, #888);
    padding: 0 4px;
}
.pm-sound-listen {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1px solid var(--border, #e3e3e6);
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted, #888);
    font-size: 0.6rem;
    line-height: 1;
    cursor: pointer;
}
.pm-sound-listen:hover { color: var(--text, #222); border-color: var(--text-muted, #888); }
.pm-settings-hint {
    margin-top: 8px;
    font-size: 0.72rem;
    color: var(--text-muted, #888);
}
.pm-body {
    flex: 1 1 auto;
    min-height: 260px;
    max-height: 52vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg, #f7f7f8);
}
.pm-empty {
    color: var(--text-muted, #888);
    text-align: center;
    margin: auto;
    font-size: 0.9rem;
}
/* Кнопка подгрузки более ранних сообщений (вверх по истории) */
.pm-load-older {
    display: block;
    margin: 0 auto 10px;
    padding: 6px 14px;
    background: transparent;
    color: var(--text-muted, #888);
    border: 1px solid var(--border, #e3e3e6);
    border-radius: 14px;
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease;
}
.pm-load-older:hover {
    color: var(--text, #222);
    border-color: var(--text-muted, #888);
}
.pm-row {
    display: flex;
    max-width: 85%;
}
.pm-mine {
    align-self: flex-end;
}
.pm-theirs {
    align-self: flex-start;
}
.pm-bubble {
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.pm-mine .pm-bubble {
    background: var(--primary, #2563eb);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.pm-theirs .pm-bubble {
    background: var(--bg-card, #fff);
    color: var(--text, #222);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border, #e5e5e5);
}
.pm-bubble-head {
    font-size: 0.72rem;
    font-weight: 600;
    opacity: 0.75;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.pm-mine .pm-bubble-head { color: rgba(255,255,255,0.85); }
.pm-theirs .pm-bubble-head { color: var(--text-muted, #888); }
.pm-time {
    font-weight: 400;
    opacity: 0.7;
}
/* ===== Реакции-смайлики в ЛС =====
   Раскладка выведена из правила равных/кратных отступов проекта:
   круг кнопки 22px (как .pm-act), иконка 12px, поля по 5px = (22-12)/2.
   Отступ кнопки от края пузыря — 10px (margin-left у .pm-acts-reaction). */

/* Кнопка-смайлик реакции: ЖИВЁТ РЯДОМ С ПУЗЫРЁМ, в блоке .pm-acts (просьба 18.09.26),
   тем же кругом 22px, что «изменить/удалить» (.pm-act).
   Было: absolute в правом верхнем углу чужого пузыря — смайлик висел на тексте
   сообщения, и голове пузыря приходилось держать запас padding-right: 26px. */
/* ⚠ Специфичность. .pm-acts/.pm-act объявлены НИЖЕ по файлу (стр. ~4035), а это
   правило — выше, поэтому «голый» класс .pm-acts-reaction проигрывал бы их
   margin-left:auto (проверено на проде: computed margin-left был 0px, хотя в файле
   стоит 10px). Прижимаем через более специфичный селектор с родителем .pm-row. */
.pm-row .pm-acts-reaction {
    /* Чужой пузырь идёт в строке ПЕРВЫМ, а смайлик должен оказаться СПРАВА от него:
       order переставляет элементы визуально, не меняя порядок в HTML. */
    order: 2;
    margin-left: 10px;
    margin-right: 0;
}
/* Кнопка реакции — это ЭЛЕМЕНТ .pm-act (разметку рисует pm.js):
   форма/фон/цвет/показ при наведении наследуются от него, здесь только иконка.
   ⚠ Не описываем геометрию через .pm-react-open: у этого класса специфичность
   та же, что у .pm-act, а .pm-act объявлен НИЖЕ по файлу — он бы перебил правило
   (проверено на стенде: кнопка получалась 16×21 вместо круга 22×22). */
/* Иконка смайлика КРУПНЕЕ, чем у edit/del (10px): просьба 18.09.26 — увеличить именно
   иконку, а не круг. Круг остаётся 22px (.pm-act), поля по краям = (22-16)/2 = 3px —
   смайлик крупный, но не липнет к краю кнопки.
   ⚠ Селектор с родителем .pm-row обязателен: `.pm-act svg { width:10px }` объявлен
   НИЖЕ по файлу и при равной специфичности перебивает (замер на стенде дал 10px,
   хотя в файле стояло 16px). */
.pm-row .pm-react-open svg {
    width: 16px;
    height: 16px;
    display: block;
}
/* Открытая панель: кнопка остаётся подсвеченной. Специфичность 0-2-0 —
   гарантированно перебивает .pm-act (0-1-0), поэтому здесь .pm-react-open уместен. */
.pm-row .pm-react-open.is-active {
    opacity: 1;
    background: var(--pm-act-bg-hover, #eeeeee);
}
/* Убираем рамку фокуса после КЛИКА (у кнопок реакций и в списке, и в панели).
   Браузер по умолчанию рисует синюю обводку вокруг нажатой кнопки — она
   остаётся висеть и выглядит как «выделенный смайлик».
   Клавиатурный фокус при этом СОХРАНЯЕМ (правило ниже, :focus-visible) —
   иначе при навигации табом не видно, где находишься. Тот же приём, что у
   .notif-bell в этом файле. */
.pm-react-open:focus,
.pm-react-open:active,
.pm-react-pick:focus,
.pm-react-pick:active,
.pm-react-badge:focus,
.pm-react-badge:active {
    outline: none;
}
.pm-react-open:focus-visible,
.pm-react-pick:focus-visible,
.pm-react-badge:focus-visible {
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 2px;
}
/* Смайлик внутри выбранной кнопки: убираем и подчёркивание/рамку от :active. */
.pm-react-pick:active {
    transform: scale(0.95);
}
/* На узком экране вертикаль панели тоже считает JS (positionReactPanel): он решает,
   вниз или вверх раскрывать, и ставит top/bottom инлайном. В CSS оставляем только
   горизонтальный анкер и точку трансформации — иначе медиазапрос и JS-инлайн спорили бы
   за одно свойство, и панель прыгала при открытии (жалоба 18.09.26: «выезжает рывками»).
   Right-анкер уже задан базовым правилом ниже (right:100%), он одинаков для всех ширин. */
@media (max-width: 600px) {
    .pm-react-panel {
        transform-origin: right top;
    }
}

/* Панель со смайликами: ВЫЕЗЖАЕТ ВНИЗ из-под кнопки-смайлика (просьба 18.09.26).
   Позиционируется от обёртки .pm-react-panel-bd внутри блока иконок .pm-acts
   (обёртка = position: relative), а сама панель прижата к правому краю кнопки —
   выравнивание по одной оси с кружком смайлика.

   ⚠ ГРАБЛИ (17.09.26): НЕ ставить opacity:0 в базовое правило. Панель создаётся
   уже видимой и анимируется только «выездом»; если базовый opacity:0 держать,
   то после завершения animation (fill-mode forwards не удерживает состояние
   при перерисовке) панель остаётся прозрачной — в DOM 6 смайликов, а глазами
   пусто. Поэтому видимость задаётся только кейфреймом. */
.pm-react-panel-bd {
    position: relative;
    /* inline-block + нулевые размеры: обёртка существует только как точка отсчёта
       для абсолютной панели и не должна участвовать в раскладке .pm-acts
       (иначе в колоночном .pm-acts появлялась бы вторая строка и пузырь съезжал). */
    display: inline-block;
    width: 0;
    height: 0;
}
.pm-react-panel {
    position: absolute;
    /* Вертикаль по умолчанию — ПОД кнопкой. Направление (вниз/вверх) уточняет JS
       через positionReactPanel(), выставляя top/bottom инлайном; margin-зазор при
       перевороте тоже переключается там. */
    /* Позицию (left/top либo left/bottom) выставляет JS — positionReactPanel() в pm.js:
       он считает её В ПИКСЕЛЯХ от фактического прямоугольника кнопки, потому что обёртка
       нулевая (0×0) и права/низ от неё не совпадают с краями кнопки. Значения ниже —
       только fallback на случай, если JS не успел/не смог (панель всё равно появится
       под кнопкой, а не в углу экрана). */
    top: 100%;
    bottom: auto;
    right: 100%;
    left: auto;
    margin-top: 6px;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px 4px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    white-space: nowrap;
    z-index: 3;
    transform-origin: right top;

    /* ==== Плавный выезд вниз (просьба 18.09.26: «выезжает рывками — надо плавно») ====

       Почему дёргалось (разбор прежнего варианта .16s translateY(-8px) scaleY(.9)):
       1. Слой не был подготовлен: без will-change браузер создаёт композитный слой
          В ПЕРВОМ кадре анимации, поэтому первый-второй кадр проваливаются — это и
          читается как рывок в начале.
       2. scaleY сжимал САМУ панель вместе со смайликами: содержимое сплющивалось и
          «щёлкало» на последнем кадре, а не выезжало.
       3. .16s на 8px = ~3 кадра — движение успевало начаться и сразу кончиться,
          линейный «толчок» вместо выезда.

       Как сделано теперь:
       - анимируем ТОЛЬКО transform (сдвиг по Y) и opacity — обе операции композитные,
         не вызывают перерисовку рамки/тени;
       - will-change: transform|opacity поднимает элемент на свой слой ЗАРАНЕЕ;
       - без scale: смайлики не деформируются;
       - .24s + cubic-bezier(.22,.61,.36,1) — быстрый старт, мягкое торможение
         (движение «выезжает и оседает», а не обрывается).

       ⚠ ГРАБЛИ (17.09.26, сохраняем): НЕ ставить opacity:0 в базовое правило. Панель
       создаётся уже видимой и анимируется только «выездом»; если базовый opacity:0
       держать, то после завершения animation панель остаётся прозрачной — в DOM
       6 смайликов, а глазами пусто. Поэтому стартовая прозрачность задаётся ТОЛЬКО
       кейфреймом, а конечная (opacity:1) — самим базовым правилом. */
    opacity: 1;
    will-change: transform, opacity;
    backface-visibility: hidden;
    animation: pmReactSlide .24s cubic-bezier(.22, .61, .36, 1);
}
@keyframes pmReactSlide {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
/* Появление СНИЗУ ВВЕРХ, когда панель раскрывается над кнопкой (мало места снизу):
   класс навешивает JS, кейфрейм зеркальный — движение всегда «из кнопки наружу»,
   иначе выезд шёл бы против направления раскрытия. */
.pm-react-panel--up {
    animation-name: pmReactSlideUp;
}
@keyframes pmReactSlideUp {
    from {
        transform: translateY(10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
/* Плавное ЗАКРЫТИЕ: панель уезжает обратно тем же движением. Класс навешивает JS
   (closeReactPanel), и узлы удаляются по animationend — иначе панель исчезала
   «щелчком» (жалоба 18.09.26). Длительность чуть короче открытия: закрытие должно
   ощущаться отзывчивее, чем появление. */
.pm-react-panel.is-closing {
    animation: pmReactSlideOut .16s cubic-bezier(.4, 0, 1, 1) forwards;
    pointer-events: none;   /* по уезжающей панели уже нельзя кликнуть */
}
@keyframes pmReactSlideOut {
    from { transform: translateY(0); opacity: 1; }
    to   { transform: translateY(-8px); opacity: 0; }
}
/* Закрытие панели, раскрытой ВВЕРХ — уезжает вниз. */
.pm-react-panel--up.is-closing {
    animation-name: pmReactSlideOutUp;
}
@keyframes pmReactSlideOutUp {
    from { transform: translateY(0); opacity: 1; }
    to   { transform: translateY(8px); opacity: 0; }
}

/* Уважаем системную настройку «уменьшить движение»: панель просто появляется. */
@media (prefers-reduced-motion: reduce) {
    .pm-react-panel,
    .pm-react-panel.is-closing { animation: none; will-change: auto; }
}

.pm-react-pick {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background .12s ease, transform .12s ease;
}
.pm-react-pick:hover {
    background: rgba(0,0,0,0.06);
    transform: scale(1.15);   /* смайлик «отзывается» на курсор */
}

/* Плашка уже поставленной реакции: ВНУТРИ пузыря, под текстом.
   Обводки нет (просьба 18.09.26) — только фон и смайлик.
   Отступ сверху 4px = отступу кнопки реакции от края пузыря. */
.pm-react-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-top: 4px;
    padding: 1px 6px;
    border: 0;                     /* обводка убрана: плашка — просто смайлик на фоне */
    border-radius: 10px;
    background: var(--bg-card, #fff);
    color: var(--text, #222);
    font-size: 12px;
    line-height: 1.5;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .12s ease;
}
/* У своих сообщений пузырь синий — белая плашка на нём читается лучше. */
.pm-mine .pm-react-badge {
    background: #fff;
}
.pm-react-badge:hover {
    background: rgba(0,0,0,0.04);
}
.pm-mine .pm-react-badge:hover {
    background: #f2f2f2;
}
.pm-react-emoji {
    font-size: 13px;
    line-height: 1;
}
.pm-react-count {
    font-size: 11px;
    opacity: 0.7;
}


.pm-read-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    margin-left: 2px;
    vertical-align: middle;
}
/* Значок «изменено» — в той же строке, что и иконка прочитанности, тем же размером */
.pm-edited-icon {
    display: inline-flex;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    margin-left: 2px;
    opacity: 0.8;
    /* та же ось, что у иконки прочитанности */
    transform: translateY(-2px);
}
.pm-edited-icon svg {
    width: 100%;
    height: 100%;
}
/* Иконки действий (изменить/удалить) — СЛЕВА от пузыря, на белом поле.
   Раньше жили внутри пузыря и были белыми (color: inherit); теперь это отдельный
   элемент строки: серый цвет, видны при наведении.
   margin-left: auto прижимает всю группу вправо вместе с пузырём (у .pm-mine
   выравнивание по правому краю задаётся именно этим, а не align-self пузыря).
   Иконки стоят КОЛОНКОЙ и ЦЕНТРИРУЮТСЯ ПО ВЫСОТЕ пузыря (просьба 14.09.26):
   было align-self: flex-end + padding-bottom: 6px — группа липла к низу. */
.pm-acts {
    display: flex;
    flex-direction: column;   /* вертикально: редактировать над удалить */
    align-items: center;
    /* Зазор между кругами = gap + margin-bottom у .pm-act-edit.
       Отступ edit минимальный (1px), чтобы он не слился с del. */
    gap: 2px;
    flex-shrink: 0;
    margin-left: auto;
    margin-right: 10px;       /* отступ от синего пузыря (было 8px, потом 5px, теперь +5px) */
    /* Центр по высоте пузыря: группа иконок встаёт на одну ось с сообщением,
       а не у нижнего края. padding-bottom убран — он сдвигал группу вверх против центра. */
    align-self: center;
}
/* Кнопка действия: круглая подложка с иконкой внутри.
   Размеры выведены из правила равных отступов: круг 22px, иконка 10px,
   поля по 6px с каждой стороны ((22-10)/2) — иконка не липнет к краю круга.
   Фон и иконка осветлены ЕЩЁ на 30% (просьба 14.09.26, вторая итерация):
   фон #ececec -> #f2f2f2 -> #f6f6f6, иконка #333333 -> #707070 -> #9b9b9b.
   Осветление считается от белого базы: c + (255-c)*0.3, так сохранён
   тот же контраст пары фон/иконка. Кнопки не «давят» на белом поле. */
.pm-act {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;       /* круг */
    background: var(--pm-act-bg, #f6f6f6);
    color: var(--pm-act-color, #9b9b9b);
    opacity: 0;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity .15s ease, background .15s ease, color .15s ease;
}
.pm-act svg {
    width: 10px;
    height: 10px;
    display: block;
}
/* «Изменить» стоит прямо над «Удалить». Зазор между кругами складывается из
   этого отступа и gap: 1px + 2px = 3px (путь: 11px -> 6px -> 3px).
   Отступ СНИЗУ у кнопки редактирования, чтобы «удалить» осталась на своей оси
   у нижнего края пузыря — якорем группы служит именно она. */
.pm-act-edit {
    margin-bottom: 1px;
}
/* Показываем действия при наведении на строку сообщения (на мобиле — всегда) */
.pm-row:hover .pm-act,
.pm-acts:hover .pm-act {
    opacity: 1;
}
/* Наведение: круг темнеет (относительно нового светлого фона), иконка остаётся серой —
   так кнопка «отзывается» на курсор. #dcdcdc -> #e7e7e7 -> #eeeeee (те же +30%),
   разница с базовым #f6f6f6 осталась той же по контрасту. */
.pm-act:hover {
    opacity: 1 !important;
    background: var(--pm-act-bg-hover, #eeeeee);
}
/* Удаление при наведении — красный круг, чтобы действие читалось как опасное.
   Пара тоже осветлена на 30% (просьба 14.09.26): #f7dcdc -> #f9e6e6,
   #c62828 -> #d76868 — на новом светлом фоне красный не «выжигает» глаз,
   но остаётся читаемым. */
.pm-act-del:hover {
    background: #f9e6e6;
    color: #d76868;
}
@media (hover: none) {
    .pm-act { opacity: 0.9; }
}
/* ==== Мобильные крестики «✕» — крупнее (просьба 14.09.26) ====
   Задевает два окна: «Уведомления» и вкладку «Сообщения» (крестик у них ОДИН —
   #notif-close с классом .modal-close в общей модалке .notif-modal), а также
   модалку изображения из ЛС (.pm-img-modal-close).
   Размеры: 1.1rem -> 1.5rem (17.6px -> 24px) и 30px -> 40px у области нажатия
   (40px — минимальный комфортный размер для пальца). */
@media (max-width: 600px) {
    .notif-header .modal-close {
        font-size: 1.5rem;
        /* Крестик — цель для пальца, а не для курсора: увеличиваем и область нажатия. */
        min-width: 40px;
        min-height: 40px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        /* Прижимаем к правому краю шапки: с ростом ширины flex-элемент иначе
           «съезжает» влево от края. */
        margin-left: auto;
    }
    .pm-img-modal-close {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
    }
}
/* ==== Мобильная раскладка иконок действий (просьба 14.09.26) ====
   Круги стоят ГОРИЗОНТАЛЬНО с отступом 10px и ЦЕНТРИРУЮТСЯ ПО ВЫСОТЕ пузыря.
   Размеры меньше на 10% от прежних мобильных (28px -> 25px, иконка 12px -> 11px).
   Иконки ТЁМНО-СЕРАЯ (#333), а не чёрная. На десктопе всё это не применяется:
   там колонка, 22px, чёрные иконки, прижатие к низу пузыря. */
@media (max-width: 600px) {
    .pm-acts {
        flex-direction: row;   /* горизонтально вместо колонки */
        gap: 10px;             /* отступ между кругами */
        align-items: center;
        margin-right: 10px;    /* отступ от синего пузыря */
        /* Центр по высоте пузыря: было flex-end + padding-bottom: 6px (прижатие к низу). */
        align-self: center;
        padding-bottom: 0;
    }
    /* Блок со смайликом реакции стоит СПРАВА от чужого пузыря — здесь margin-right
       лишний, а зазор с пузырём даёт margin-left (10px, как у своих действий).
       Родитель .pm-row — чтобы перебить .pm-acts ниже по файлу (та же причина,
       что и у десктопного правила). */
    .pm-row .pm-acts-reaction {
        margin-right: 0;
    }
    /* Подъём «редактировать» — только для вертикальной раскладки: в ряду он сдвинул бы
       кнопку вверх и сломал ось. */
    .pm-act-edit {
        margin-bottom: 0;
    }
    .pm-act {
        width: 25px;           /* было 28px, теперь -10% */
        height: 25px;
        /* Цвет НЕ задаём: наследуем базовый .pm-act (#9b9b9b — осветлённый серый).
           Раньше здесь стоял жёсткий #333, который перебивал базовый цвет и делал
           мобильные иконки заметно темнее десктопных. */
    }
    .pm-act svg {
        width: 11px;           /* было 12px, теперь -10% */
        height: 11px;
    }
}
/* Инлайн-редактирование сообщения.
   Textarea вставлена ВНУТРЬ .pm-bubble-text (внутри пузыря): текст должен выглядеть
   РОВНО как обычный текст сообщения — та же гарнитура/размер/межстрочный, без своих
   полей и рамки, которые «сдвигают» текст (правка 14.09.26).
   Кнопки «Сохранить/Отмена» лежат ЗА пузырём — см. .pm-edit-actions ниже. */
.pm-edit-input {
    display: block;
    width: 100%;
    min-width: 0;              /* НЕ 180px: в режиме правки ширина задаётся из JS,
                                  а собственный минимум textarea мешал пузырю
                                  сохранять исходную ширину (баг 14.09.26) */
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;   /* фон пузыря просвечивает — как у текста */
    color: inherit;            /* цвет текста пузыря (белый на синем) */
    font-family: inherit;
    font-size: inherit;        /* от .pm-bubble (0.9rem) */
    line-height: inherit;      /* от .pm-bubble (1.4) */
    font-weight: inherit;
    letter-spacing: inherit;
    /* resize отключён: высота управляется из JS (autoGrowPmTextarea по содержимому),
       рукоятка ресайза тянула бы поле за пределы пузыря. */
    resize: none;
    outline: none;
    box-shadow: none;
    /* Обычно прокрутки нет — поле растёт само. JS включает overflow-y: auto,
       если текст длиннее max-height (очень длинные сообщения). */
    overflow-y: hidden;
    /* Потолок высоты: выше него поле скроллится, а не растягивает пузырь на весь экран.
       40vh согласован с .pm-body (max-height: 52vh) — поле правки заведомо ниже окна. */
    max-height: 40vh;
}
/* Пузырь в режиме правки: ширина фиксируется из JS (по замеру ДО правки), поэтому
   box-sizing обязателен — иначе padding добавлялся бы сверх зафиксированной ширины. */
.pm-row-editing .pm-bubble {
    box-sizing: border-box;
}
/* Обводки в фокусе НЕТ (просьба 14.09.26): поле правки не должно получать никакой
   рамки/свечения — текст выглядит как обычное сообщение, и ничего не «прыгает».
   Раньше здесь был box-shadow (белый 2px, затем тёмно-синий 1px) — убрано совсем.
   ⚠ :focus прописан ЯВНО, потому что глобальное правило
   `input:focus, textarea:focus` (см. выше) рисует синее свечение 2px всем полям.
   Полагаться на одну специфичность класса нельзя: при смене порядка правил
   обводка вернулась бы незаметно. */
.pm-edit-input:focus,
.pm-theirs .pm-edit-input:focus {
    box-shadow: none;
    outline: none;
    border-color: transparent;
}

/* ==== Режим правки сообщения ====
   Строка раскладывается СТОЛБИКОМ: пузырь сверху, кнопки «Сохранить/Отмена»
   под ним — на белом поле, ЗА пузырём (просьба 14.09.26).
   .pm-row по умолчанию flex-строка (иконки действий + пузырь), поэтому здесь
   переключаем направление и выравнивание по правому краю (для своих сообщений). */
.pm-row-editing {
    flex-direction: column;
    align-items: flex-end;   /* свои сообщения прижаты вправо */
}
.pm-theirs.pm-row-editing {
    align-items: flex-start; /* чужие — влево */
}
/* В режиме правки иконки действий (edit/del) не нужны — идёт правка, действия сбивали бы. */
.pm-row-editing .pm-acts {
    display: none;
}
.pm-edit-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;         /* отступ от пузыря — кнопки стоят ЗА ним */
    flex-shrink: 0;
}
/* Кнопки лежат на БЕЛОМ поле (вне пузыря), поэтому тёмный текст на светлом фоне.
   Раньше были внутри синего пузыря и требовали белых цветов — см. историю ниже. */
.pm-edit-save,
.pm-edit-cancel {
    padding: 3px 10px;
    border-radius: 10px;
    border: 1px solid var(--border, #e3e3e6);
    background: transparent;
    color: var(--text, #222);
    font-family: inherit;
    font-size: 0.78rem;
    line-height: 1.3;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.pm-edit-cancel:hover {
    background: var(--bg, #f2f2f3);
}
.pm-edit-save {
    border-color: transparent;
    background: var(--accent, #2f3033);
    color: #fff;
}
.pm-edit-save:hover {
    opacity: 0.88;
}
/* read — поднята на 3px вверх относительно unread (-2px) */
.pm-read-icon--read {
    transform: translateY(-2px);
}
.pm-read-icon--unread {
    opacity: 0.45;
    transform: translateY(1px); /* опущена на 1px для оптического выравнивания со временем */
}
.pm-bubble-text {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}
.pm-input-row {
    display: flex;
    /* Центрируем скрепку, поле ввода и «Отправить» по ОДНОЙ горизонтальной оси.
       Было align-items: flex-end (выравнивание по низу): центр кнопок оказывался
       на 6px ниже центра поля, потому что .pm-input-wrap выше textarea (подсказка
       .pm-input-hint) и низ кнопок совпадал с низом wrap, а не с полем (жалоба 14.09.26). */
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
}
.pm-input-wrap {
    flex: 1 1 auto;
}
.pm-input-wrap textarea {
    display: block;          /* убирает зазор под inline-элементом (baseline),
                                из-за которого .pm-input-wrap был выше поля на ~6px
                                и кнопки не вставали с ним на одну ось */
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    outline: none;
    min-height: 40px;
    box-sizing: border-box;
}
.pm-input-wrap textarea:focus {
    border-color: var(--primary);
}
.pm-input-wrap textarea:disabled {
    background: var(--bg, #f2f2f3);
    color: var(--text-muted);
}
.pm-input-hint {
    font-size: 0.78rem;
    color: var(--danger, #d63638);
    margin-top: 5px;
}
.pm-send-btn {
    flex-shrink: 0;
    /* Круглая кнопка 40×40 с синим фоном (фон даёт .btn-primary = var(--primary)).
       padding и border-radius переопределяем: базовый .btn идёт с padding 8px 16px
       и radius var(--radius)=8px, из-за чего кнопка была «таблеткой». */
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    /* Меньше базового .btn (0.95rem) — стрелка заметно вылезала за круг. */
    font-size: 0.9rem;
    line-height: 1;
}
.pm-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
/* Кнопка «вставить изображение» — слева от поля ввода, по высоте кнопки отправки.
   Прозрачная, иконка скрепки в currentColor: не спорит с кнопкой «➤».
   Элемент — <label for="pm-image-input">, а не button: так системный диалог выбора
   файла открывает сам браузер, нативно и мгновенно (см. комментарий в layout.php). */
.pm-attach-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    /* Рамки нет (просьба 14.09.26): скрепка — «голая» иконка без обводки и фона.
       Было border: 1px solid var(--border) + border-radius: 10px. */
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-muted, #888);
    cursor: pointer;
    box-sizing: border-box;
    transition: color .15s ease, opacity .15s ease;
}
/* label по умолчанию inline — сбрасываем, иначе размеры поедут */
.pm-attach-btn { line-height: 1; -webkit-tap-highlight-color: transparent; }
.pm-attach-btn svg { width: 18px; height: 18px; display: block; pointer-events: none; }
.pm-attach-btn:hover {
    color: var(--text, #222);
    /* border-color убран вместе с рамкой — при наведении меняется только цвет иконки. */
}
/* Фокус с клавиатуры видим (label с tabindex=0) */
.pm-attach-btn:focus-visible {
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 2px;
}
/* Пока файл летит на сервер — лёгкая пульсация и запрет повторного клика. */
.pm-attach-btn.is-busy {
    animation: pm-attach-pulse 1s ease-in-out infinite;
    pointer-events: none;
    opacity: 0.6;
}
@keyframes pm-attach-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
}
/* Сообщение-изображение: текста нет, вместо него — строка-кнопка открытия модалки. */
.pm-img-link {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    text-decoration-color: currentColor;
    opacity: 0.95;
}
.pm-img-link:hover { opacity: 1; }
.pm-img-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
/* ==== Модалка изображения из ЛС ====
   Отдельный слой ПОВЕРХ окна уведомлений (z-index выше .notif-modal), потому что
   открывается изнутри него. Своя подложка-затемнение, клик по ней = закрытие = удаление. */
.pm-img-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}
.pm-img-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}
.pm-img-modal-box {
    position: relative;
    display: flex;
    flex-direction: column;
    max-width: min(920px, 92vw);
    max-height: 88vh;
    background: var(--card, #fff);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
/* Полоса сверху: предупреждение слева, крестик справа — «рядом с крестиком» по ТЗ. */
.pm-img-modal-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px 10px 16px;
    border-bottom: 1px solid var(--border);
}
.pm-img-modal-note {
    flex: 1 1 auto;
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--text-muted, #888);
}
.pm-img-modal-close {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text, #222);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.pm-img-modal-close:hover {
    background: var(--accent, #2f3033);
    color: #fff;
}
.pm-img-modal-view {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg, #f7f7f8);
    padding: 10px;
}
.pm-img-modal-view img {
    max-width: 100%;
    max-height: calc(88vh - 100px);
    object-fit: contain;
    border-radius: 8px;
    /* Долгий тап на iOS не должен открывать системное меню «Сохранить в Фотоплёнку»;
       правую кнопку гасит contextmenu в pm.js. */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
@media (max-width: 600px) {
    .pm-img-modal { padding: 10px; }
    .pm-img-modal-note { font-size: 0.72rem; }
}
.no-comments {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    padding: 20px 0;
}

/* Feed */
.feed-page h1 {
    margin-bottom: 20px;
    font-size: 1.3rem;
}
.feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.feed-header h1 {
    margin-bottom: 0;
}
.feed-site-stats {
    font-size: 12px;
    color: var(--text-muted);
    margin: 6px 0 14px;
}
.feed-test-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: -12px;
    margin-bottom: 20px;
}

/* Toggle switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}
.toggle-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.toggle-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--border);
    border-radius: 10px;
    transition: background 0.2s;
}
.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-switch input {
    display: none;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}
.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(16px);
}

.feed-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.feed-sentinel {
    text-align: center;
    padding: 20px;
}
.feed-loading {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Static lightbox — для inline-изображений из !![]() и комментариев */
#lightbox, .lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}
#lightbox .lightbox-close {
    position: fixed;
    top: 12px;
    right: 16px;
    font-size: 2rem;
    color: #fff;
    background: rgba(0,0,0,0.4);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
#lightbox .lightbox-close:hover { background: rgba(255,255,255,0.2); }
#lightbox #lightbox-img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

/* Lightbox — полноэкранный с навигацией */
.gallery-lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.lightbox-close {
    position: fixed;
    top: 12px;
    right: 16px;
    font-size: 2rem;
    color: #fff;
    background: rgba(0,0,0,0.4);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }

.lightbox-prev, .lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    color: #fff;
    background: rgba(0,0,0,0.4);
    border: none;
    width: 50px;
    height: 80px;
    border-radius: 8px;
    cursor: pointer;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
}
.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,0.25); }

.lightbox-counter {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0,0,0,0.5);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 2001;
}

.lightbox-image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    touch-action: pan-y;
}
/* Вариант с подписью (напр. медаль-награда конкурса): колонка, подпись под картинкой. */
.gallery-lightbox.has-caption {
    flex-direction: column;
    justify-content: center;
}
.gallery-lightbox.has-caption .lightbox-image-wrap {
    flex: 0 0 auto;
    width: auto;
    height: auto;
    padding: 0;
}
.gallery-lightbox.has-caption .lightbox-image {
    max-height: 82vh;
}
.gallery-lightbox.has-caption .lightbox-caption {
    margin-top: 16px;
    padding: 0 16px;
}
.lightbox-image {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

@media (max-width: 600px) {
    .lightbox-prev, .lightbox-next {
        width: 40px;
        height: 56px;
        font-size: 1.8rem;
    }
    .lightbox-prev { left: 4px; }
    .lightbox-next { right: 4px; }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}
.empty-state h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    color: var(--text-muted);
}
.empty-state p {
    color: var(--text-secondary);
}

/* Success / Error messages */
.success-msg {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: var(--success);
    padding: 8px 12px;
    border-radius: var(--radius);
    margin-bottom: 12px;
}
.error-msg {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    padding: 8px 12px;
    border-radius: var(--radius);
    margin-bottom: 12px;
}

/* Post full */
.post-full {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 0;
    box-shadow: var(--shadow);
    max-width: 100%;
    overflow: visible;
    box-sizing: border-box;
}
/* Выпадающее меню «⋯» внутри поста не подрезаем снизу (overflow:visible) */
.post-full .post-menu {
    z-index: 50;
}

/* --- Шапка поста на странице поста: ЕДИНЫЙ шаблон с лентой (зеркало .feed-page .post-card) --- */
.post-full .post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    position: relative;
    flex-wrap: nowrap;
}
.post-full .post-header .avatar-wrapper {
    flex-shrink: 0;
}
.post-full .post-header .avatar-wrapper img {
    width: 96px;
    height: 96px;
    border-radius: 16px;
    object-fit: cover;
}
.post-full .post-header .post-author-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    transition: color 0.15s;
}
.post-full .post-header .post-author-name:hover {
    color: var(--primary);
}
.post-full .post-header .btn-icon.post-menu-btn {
    font-size: 2.1rem;
    padding: 2px 8px;
    line-height: 1;
    border-radius: 8px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.post-full .post-header .btn-icon.post-menu-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text);
}
.post-full .online-dot {
    width: 20px;
    height: 20px;
    bottom: 2px;
    right: 2px;
    border-width: 3px;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .container { padding: 0 12px; }
    .post-card { padding: 12px; }
    .post-title { font-size: calc(1.1rem - 1px); }   /* уменьшен на 1px */
    .profile-stats { gap: 8px; }
    .stat-item { min-width: 50px; }
    .stat-value { font-size: 1rem; }
    .comment-replies { margin-left: 4px; padding-left: 3px; }

    .post-header .post-time {
        order: 1;
    }

    .post-header .post-menu-btn {
        order: 1;
    }
}

/* Tablet */
@media (min-width: 768px) {
    .container { max-width: 1290px; }
    .post-gallery { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    /* Модалки на десктопе — шире и выше на 50% */
    .modal-popup {
        width: 570px;            /* 380 × 1.5 */
        max-width: 92vw;
        max-height: 90vh;        /* выше (90vh — практический предел экрана) */
    }
    /* Окно уведомлений шире прочих модалок: внутри закладка «Сообщения»
       с колонкой аватарок (64px) + переписка. Задаём ЗДЕСЬ, а не в общем
       блоке .notif-modal — иначе это правило (ниже по файлу, та же
       специфичность) перебивало бы его. */
    .notif-modal {
        width: 800px;
        max-width: 94vw;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .container { max-width: 1290px; }
}

/* ========================================
   KnowItAll — term tooltips
   ======================================== */
.know-term {
    color: #c9a84c;
    cursor: help;
    border-bottom: 1px dashed #c9a84c;
    position: relative;
}
.know-term:hover { color: #e0c565; }
.know-tooltip {
    display: none;
    position: fixed;
    z-index: 10001;
    background: #1e1e2e;
    border: 1px solid #c9a84c;
    border-radius: 8px;
    padding: 12px 14px;
    max-width: 350px;
    min-width: 200px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
    font-size: 14px;
    line-height: 1.6;
    color: #e0d5c1;
    pointer-events: auto;
}
/* Мобильный: окно Всезнайки во всю ширину экрана (отступы симметричные 14px, как padding тултипа) */
@media (max-width: 767px) {
    .know-tooltip {
        left: 14px !important;
        right: 14px !important;
        width: auto !important;
        max-width: none;
        min-width: 0;
        box-sizing: border-box;
    }
}
.know-tooltip .kt-text {
    display: block;
    margin: 0;
    line-height: 1.6;
}
.know-tooltip .kt-text a {
    color: #c9a84c;
    font-weight: bold;
    text-decoration: underline;
}
.know-tooltip .kt-text a:hover { color: #e0c565; }
.know-loading {
    color: #888;
    font-style: italic;
}

/* ========================================
   Бот «Всезнайка» — кнопка «?» в визредакторе
   (круглая тёмная иконка; выделенный текст → подчёркнутый know-term)
   ======================================== */
.ql-knowterm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0 !important;
    margin: 0 2px !important;
    border: none !important;
    background: transparent !important; /* тёмный круг рисует сама SVG (fill=currentColor) */
    cursor: pointer;
    vertical-align: middle;
    line-height: 0;
    box-sizing: border-box;
    border-radius: 50%;
}
.ql-knowterm .kn-icon {
    display: block;
    width: 20px;
    height: 20px;
    color: #2f3033;          /* тёмный круг (#2f3033) */
    border-radius: 50%;
    transition: transform .12s ease;
}
.ql-knowterm:hover .kn-icon {
    color: #1a1b1d;
    transform: scale(1.08);
}
.ql-snow .ql-toolbar button.ql-knowterm.ql-active .kn-icon {
    transform: scale(1.08);
    color: #000;
}

/* Подчёркнутый know-term внутри редактора */
.editor-quill span.know-term {
    color: #c9a84c;
    cursor: help;
    border-bottom: 1px dashed #c9a84c;
    background: rgba(201,168,76,.08);
}

/* ===== Боковая «Эфир» лента активности (блок в правом сайдбаре) ===== */
.sidebar-activity {
    margin: 20px 0 12px 0;        /* 20px сверху — над серой линией */
    padding-top: 20px;            /* 20px снизу от линии до заголовка */
    border-top: 1px solid var(--border);  /* серая линия над блоком активности */
    width: 100%;
    box-sizing: border-box;
}
/* 14.09.26 (юзер): над блоком «Эфир» горизонтальной линии НЕТ на десктопе.
   Линия была border-top у .sidebar-activity, но этот же класс носят «Активность
   сайта», «Кто онлайн», «Чат» и др. — снятие границы у базового правила убрало бы
   разделители у всех. Гасим ТОЧЕЧНО: «Эфир» — единственный блок с #activity-list,
   поэтому :has(#activity-list) попадает ровно в него и ни в один другой.
   Отступы не трогаем: без линии padding-top: 20px читается как обычный воздух
   между блоками (margin 20px + padding 20px = 40px — как визуально и было).
   На мобиле линию возвращаем: там блок свёрнут в модалку и разделитель полезен. */
.sidebar-activity:has(#activity-list) {
    border-top: 0;
}
.sidebar-activity-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 15px 0;
    font-size: 1rem;              /* заголовки правого столбца */
    font-weight: 700;
    letter-spacing: normal;       /* без разрядки, как обычный заголовок */
    text-transform: none;         /* без uppercase */
    color: #222;
}
/* «Эфир»: пространство под заголовком +15px (база 15 → 30px); сверху 0 —
   20px-отступ от серой линии уже даёт padding-top у .sidebar-activity */
.sidebar-activity .sidebar-activity-header {
    padding-top: 0;
    padding-bottom: 30px;
}
.sidebar-activity-header .act-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--online, #22c55e);
    animation: actPulse 2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes actPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}
.sidebar-activity-list {
    max-height: 50vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    width: 100%;
    box-sizing: border-box;
    padding: 0;   /* 24.08: убран padding 5px — контент начинается у левого края блока */
}
@media (max-width: 1024px) {
    .sidebar-activity { max-width: 100%; }
}
@media (max-width: 768px) {
    .sidebar-activity { width: 100% !important; margin: 0 0 12px 0; }
}
.activity-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 5px;
    transition: background 0.1s;
    border-radius: 6px;
}
.activity-item:hover {
    background: rgba(0,0,0,0.03);
}
/* 11.09.26 (юзер): аватарки в Эфире убраны — правила .notif-avatar/avatar-letter внутри
   .activity-item удалены, чтобы не оставалось пустой колонки слева. */
.activity-item .notif-content {
    flex: 1;
    min-width: 0;
    position: relative;
}

.activity-item .notif-text {
    font-size: 0.80rem;
    color: var(--text);
    line-height: 1.35;
    letter-spacing: -0.2px;
}
/* 23.08: без цветной подложки — голая иконка, +30%, центрирована по строке */
.activity-item .act-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 3px;
    flex-shrink: 0;
    vertical-align: middle;
}
/* 24.08: все иконки блёклые (-30% яркости), reply — фиолетовая */
.activity-item .act-icon {
    opacity: 0.7;
}
.act-icon--post       { color: #2563eb; }
.act-icon--comment    { color: #16a34a; }
.act-icon--reply      { color: #7c6cf0; }
.act-icon--like       { color: #e11d48; }
.act-icon--subscribe  { color: #7c3aed; }
.act-icon--block      { color: #dc2626; }
.act-icon--contest    { color: #d97706; }
.act-icon--battle      { color: #FF4D17; }
.act-icon--reaction   { color: #c026d3; }
.act-icon--cinema     { color: #0891b2; }

/* 23.08: SVG-иконки эфира (инлайн <svg> внутри .act-icon) */
.activity-item .act-icon.act-svg svg {
    width: 20px;
    height: 20px;
    display: block;
}

.activity-item .act-go,
.activity-more-wrap {
    text-align: center;
    padding: 10px 0 4px;
}
.activity-more-btn,
.activity-full-link {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--primary);
    background: none;
    border: 1px solid var(--border, #ddd);
    border-radius: 8px;
    padding: 6px 14px;
    cursor: pointer;
    text-decoration: none;
}
.activity-more-btn:hover,
.activity-full-link:hover {
    background: rgba(0,0,0,0.04);
}

/* 23.08: ссылкой на событие является выделенное слово */
.activity-item a.act-link {
    color: var(--accent, #2563eb);
    text-decoration: none;
}
.activity-item a.act-link:hover {
    text-decoration: underline;
}
.activity-item .act-title {
    font-weight: 500;
    color: var(--text);
}
/* 24.08: десктоп — время мельче на ~1px; на мобиле возвращаем 0.68rem */
.activity-item .activity-time {
    display: block;
    font-size: 0.60rem;
    color: var(--text-muted);
    margin-top: 1px;
}
.activity-item .act-go {
    opacity: 1;
    transition: opacity 0.15s;
    margin-left: 2px;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.activity-item:hover .act-go {
    opacity: 1;
}
.sidebar-activity-empty {
    padding: 24px 8px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}
.act-go {
    text-decoration: none;
}

/* ===== Блок «Индекс активности» в сайдбаре (только главная) ===== */
.sidebar-activity-index {
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 10px;
    background: var(--bg-card, #fff);
    overflow: hidden;
    margin-top: 20px;  /* серая линия сверху: отступ над ней */
    padding-top: 20px; /* и отступ под линией (верхняя граница карточки = линия) */
}
.sidebar-activity-index .sidebar-index-link {
    text-decoration: none;
    color: #222;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border, #e5e5e5);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1rem;
    font-weight: 700;
}
.sidebar-activity-index .sidebar-index-link:hover {
    color: var(--primary, #3498db);
}
.sidebar-index-body {
    padding: 14px 12px 12px;
    text-align: center;
}
.sidebar-index-big {
    font-size: 2.6rem;
    font-weight: 800;
    line-height: 1;
    color: var(--primary, #3498db);
}
.sidebar-index-lbl {
    font-size: 0.78rem;
    color: var(--text-muted, #888);
    margin-top: 6px;
    line-height: 1.3;
}
.sidebar-index-sub {
    font-size: 0.78rem;
    color: var(--text-muted, #888);
    margin-top: 8px;
}
.sidebar-index-sub b {
    color: #222;
    font-weight: 700;
}
.sidebar-index-sub a {
    color: var(--primary, #3498db);
    text-decoration: none;
    font-weight: 600;
}
.sidebar-index-sub a:hover {
    text-decoration: underline;
}

/* ===== Блок «Кто онлайн» в сайдбаре ===== */
.sidebar-online {
    margin: 0 0 12px 0;
}
.sidebar-online .sidebar-activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.online-count {
    background: var(--primary, #3498db);
    color: #fff;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 1px 8px;
}
.online-strip {
    display: grid;
    grid-template-columns: repeat(auto-fill, 40px); /* автозаполнение: сколько юзерпиков влезает в ряд по ширине фрейма */
    gap: 6px;
    padding: 12px 0; /* по левому краю вровень с заголовком (без горизонтального отступа) */
}
.online-avatar {
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.1s;
}
.online-avatar:hover {
    transform: scale(1.08);
}
.online-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.avatar-crown {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    line-height: 1;
    z-index: 3;
    pointer-events: none;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.4));
    text-shadow: 0 0 2px rgba(0,0,0,.3);
}
.avatar-crown--sm {
    font-size: 15px;
    top: -6px;
}
.avatar-crown--lg {
    font-size: 26px;
    top: -14px;
}
.avatar-crown--xs {
    font-size: 11px;
    top: -4px;
}

/* Заблокированная VIP-опция в настройках профиля («Скрыть онлайн-статус»,
   «Режим невидимки»). Тумблер виден, но недоступен; рядом — пометка ✦ VIP. */
.settings-toggle--vip-locked { opacity: .55; }
.settings-toggle--vip-locked .toggle-slider { cursor: not-allowed; }
.vip-lock-mark {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    line-height: 15px;
    color: #1d7fc4;
    background: rgba(57, 165, 245, .14);
    vertical-align: 1px;
    white-space: nowrap;
}

/* Галочка VIP после никнейма. Вставляется функцией vip_badge() —
   одна точка правки на весь сайт, поэтому стиль тоже один. */
/* Размер VIP-бейджа задаётся ЗДЕСЬ, а не процентами от родителя.
   Раньше было `svg { width:100%; height:100% }` — размер неоткуда взять:
   .vip-badge это inline-flex (ширина по контенту), а контент — тот же svg.
   Современные браузеры выручали intrinsic-размером из атрибутов svg,
   старые Safari этого не умеют → бейдж разворачивался во всю величину viewBox.
   Теперь размер задаёт переменная, svg её наследует — работает везде. */
.vip-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: -2px;
    margin-left: 4px;
    flex-shrink: 0;
    line-height: 0;
    pointer-events: none;
    --vip-size: 14px;
}
.vip-badge svg {
    display: block;
    width: var(--vip-size);
    height: var(--vip-size);
}
/* Нестандартные размеры (vip_badge($id, $size)) — класс ставит PHP.
   Класс, а не инлайн: инлайн перебил бы `h1 .vip-badge` (бейдж в заголовке Анналов). */
.vip-badge-18 { --vip-size: 18px; }
.vip-badge-16 { --vip-size: 16px; }
.vip-badge-20 { --vip-size: 20px; }
.vip-badge-22 { --vip-size: 22px; }
.vip-badge-24 { --vip-size: 24px; }
/* В заголовках (профиль, Анналы, гостевая, архив) — чуть крупнее. */
h1 .vip-badge { margin-left: 6px; vertical-align: -3px; --vip-size: 18px; }
.online-more {
    display: block;
    width: calc(100% - 24px);
    margin: 0 12px 12px;
    padding: 7px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 0.82rem;
    cursor: pointer;
    text-align: center;
}
.online-more:hover {
    border-color: var(--primary, #3498db);
    color: var(--primary, #3498db);
}
.online-empty {
    padding: 12px;
    margin: 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== Блок «Новые лица» в сайдбаре ===== */
.sidebar-newfaces {
    overflow: visible;
    margin: 0 0 12px 0;
}
.newfaces-list {
    padding: 6px 0;
}
.newface-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px 7px 0;
    text-decoration: none;
    color: var(--text);
    transition: background 0.1s;
}
.newface-row:hover {
    background: var(--bg);
}
.newface-avatar {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}
.newface-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}
.newface-avatar .online-dot {
    width: 12px;
    height: 12px;
    bottom: -1px;
    right: -1px;
    background: var(--online);
    border: 2px solid var(--bg-card);
    border-radius: 50%;
    position: absolute;
}
.newface-name {
    font-size: 0.9rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Ник в «Новичках» — такой же размер, как в остальных блоках сайдбара («Эфир» и др.: 0.8rem) */
.newface-row .notif-userlink {
    font-size: 0.80rem;
}
/* Всплывающее окно с датой регистрации (на hover) */
.newface-row::after {
    content: attr(data-reg);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) scale(0.9);
    transform-origin: bottom center;
    background: var(--text);
    color: var(--bg-card);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 20;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
}
.newface-row:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}
/* Предотвратить выход тултипа за экран у первого пункта */
.newfaces-list .newface-row:first-child::after {
    bottom: auto;
    top: calc(100% + 8px);
    transform-origin: top center;
}
.newfaces-list .newface-row:first-child:hover::after {
    transform: translateX(-50%) scale(1);
}


/* Модалка «Все онлайн» — прокручиваемый список */
.online-modal {
    max-width: 360px;
    width: 100%;
}
.online-modal-list {
    max-height: 70vh;
    overflow-y: auto;
    padding: 6px 0;
}
.online-modal-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.online-modal-item:last-child {
    border-bottom: none;
}
.online-modal-item:hover {
    background: var(--bg);
}
.online-modal-item img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.online-modal-name {
    flex: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.online-modal-rating {
    color: var(--text-muted);
    font-size: 0.85rem;
}
/* Подвал модалки «Кто онлайн»: ссылка на полный каталог юзеров (/users).
   Здесь только те, кто онлайн сейчас; каталог — все, с пагинацией.
   Отступы кратны 16px — тому же паддингу, что у .online-modal-item. */
.online-modal-footer {
    border-top: 1px solid var(--border);
    padding: 12px 16px;
    text-align: center;
}
.online-modal-all-link {
    display: inline-block;
    color: var(--primary, #2563eb);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}
.online-modal-all-link:hover {
    text-decoration: underline;
}
.online-modal-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Модалка «События» (активные конкурсы) */
.contests-modal {
    max-width: 400px;
    width: 100%;
}
.contests-modal .online-modal-list {
    max-height: 70vh;
}
.online-modal-contest-icon {
    font-size: 1.3rem;
    flex: 0 0 auto;
    line-height: 1;
}

/* Модалка «Лучшее за неделю» (мобильное окно из нижнего навбара) */
.best-modal {
    max-width: 400px;
    width: 100%;
}
.best-modal-body {
    max-height: 72vh;
    overflow-y: auto;
    padding: 6px 12px 12px;
}
.best-section { margin-bottom: 14px; }
.best-section-title {
    font-weight: 700;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}
.best-rating { color: #f5c514; font-size: 0.9rem; }
.best-item {
    display: flex; gap: 12px; align-items: center;
    padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 10px; background: var(--bg-card, #fff);
    text-decoration: none; color: var(--text);
}
.best-item:hover { border-color: var(--primary); }
.best-item-avatar-wrapper { flex: 0 0 auto; display: inline-flex; }
.best-item-avatar-wrapper img { border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.best-item-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.best-item-title { font-weight: 600; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; }
.best-item-text { font-size: 0.92rem; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.best-item-author { color: var(--text-muted, #aaa); font-size: 0.82rem; }
.best-author-metal { color: #ffb74d; }

/* ===== GIF-палитра в редакторе (кнопка .ql-gif) ===== */
.ql-gif {
    line-height: 0; /* прячем базовый текст кнопки, чтобы не двигался SVG */
    padding: 2px;
}
.ql-gif svg { display: block; }
.gif-palette {
    position: fixed;
    z-index: 3000;
    width: max-content;
    max-width: 94vw;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    padding: 10px;
}
.gif-palette-heading {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.gif-palette-load,
.gif-palette-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 8px 2px;
    text-align: center;
}
.gif-palette-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    max-height: 340px; /* Высота 5 рядов гифок при высоте 68px на плитку */
    overflow-y: auto;
}
.gif-palette-item {
    width: 100%;
    aspect-ratio: 1 / 1;   /* квадратные превью-плитки в палитре выбора GIF */
    height: 100%;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
    object-fit: cover;     /* кроп по центру до квадратной плитки */
    background: rgba(0,0,0,0.05);
    width: 68px;
    height: 68px;
}
.gif-palette-item:hover { border-color: var(--primary); }
/* GIF, вставленный в пост/комментарий. Ровно 300px (как генерится create_gif_sized 300),
   с !important, чтобы побороть общее .post-text img { width:100%; max-width:100% !important }.
   max-width:100% — чтобы на узком экране не вылезать за контейнер. */
.post-text .gif-inline,
.comment-content .gif-inline {
    width: 300px !important;
    max-width: 100% !important;
    height: auto;
    border-radius: 8px;
    margin: 4px 0;
}

/* Модалка «Новые лица» */
.newfaces-modal {
    max-width: 360px;
    width: 100%;
}
.newfaces-modal-list {
    max-height: 70vh;
    overflow-y: auto;
    padding: 6px 0;
}
.newfaces-modal-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.newfaces-modal-item:last-child {
    border-bottom: none;
}
.newfaces-modal-item:hover {
    background: var(--bg);
}
.newfaces-modal-avatar {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}
.newfaces-modal-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}
.newfaces-modal-avatar .online-dot {
    width: 12px;
    height: 12px;
    bottom: -1px;
    right: -1px;
    position: absolute;
}
.newfaces-modal-name {
    flex: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Тултип с датой регистрации в модалке */
.newfaces-modal-item::after {
    content: attr(data-reg);
    position: absolute;
    left: 50%;
    top: calc(100% + 6px);
    transform: translateX(-50%) scale(0.9);
    transform-origin: top center;
    background: var(--text);
    color: var(--bg-card);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 30;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
}
.newfaces-modal-item:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}

/* Модалка «Мои гости» */
.gosti-modal {
    max-width: 380px;
    width: 100%;
}
.gosti-modal-list {
    max-height: 70vh;
    overflow-y: auto;
    padding: 6px 0;
}
.gosti-modal-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.gosti-modal-item:last-child {
    border-bottom: none;
}
.gosti-modal-item:hover {
    background: var(--bg);
}
.gosti-modal-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}
.gosti-modal-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}
.gosti-modal-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.gosti-modal-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gosti-modal-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.gosti-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Симпатии / антипатии ===== */
.btn-reaction-sympathy {
    background: rgba(76, 175, 80, 0.12);
    border: 1px solid rgba(76, 175, 80, 0.4);
    color: #2e7d32;
}
.btn-reaction-antipathy {
    background: rgba(211, 47, 47, 0.10);
    border: 1px solid rgba(211, 47, 47, 0.4);
    color: #c62828;
}

.reaction-modal .reaction-modal-body {
    padding: 12px 16px;
}
.reaction-modal textarea {
    width: 100%;
    min-height: 80px;
    resize: vertical;
    padding: 8px 10px;
    border: 1px solid var(--border, #ddd);
    border-radius: 8px;
    font: inherit;
}
.reaction-modal-counter {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.reaction-modal-error {
    color: #c62828;
    font-size: 0.85rem;
    margin-top: 6px;
}

/* Страница «Реакции» */
.reactions-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 0 40px;
}
.reactions-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}
.reactions-header h1 {
    font-size: 1.35rem;
    letter-spacing: -0.02em;
    margin: 0;
}
.reactions-summary {
    display: flex;
    align-items: center;
    gap: 16px;
}
.reaction-count {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-muted);
}
.reaction-count .icon-svg { opacity: 0.9; }
.reaction-count.sympathy .icon-svg { color: #16a34a; }
.reaction-count.antipathy .icon-svg { color: #dc2626; }
.reactions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.reaction-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border, rgba(0,0,0,0.06));
    border-radius: 14px;
    background: var(--card-bg, #fff);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.reaction-card:hover { border-color: var(--border-strong, rgba(0,0,0,0.12)); box-shadow: 0 4px 12px rgba(0,0,0,0.07); }
.reaction-card.is-hidden { opacity: 0.65; }
.reaction-card-avatar img { border-radius: 50%; }
.reaction-card-body { flex: 1; min-width: 0; }
.reaction-card-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 6px;
}
.reaction-emoji {
    display: inline-flex;
    align-items: center;
    width: 30px;
    height: 30px;
    justify-content: center;
    border-radius: 9px;
    background: var(--bg-subtle, rgba(0,0,0,0.05));
    color: var(--text-muted);
    flex-shrink: 0;
}
.reaction-emoji .icon-svg { display: block; }
.reaction-card.sympathy .reaction-emoji { color: #16a34a; background: rgba(22,163,74,0.1); }
.reaction-card.antipathy .reaction-emoji { color: #dc2626; background: rgba(220,38,38,0.1); }
.reaction-author { font-weight: 600; color: var(--accent, #1a73e8); text-decoration: none; line-height: 1.2; letter-spacing: -0.01em; }
.reaction-author:hover { text-decoration: underline; }
.reaction-date { font-size: 0.78rem; color: var(--text-muted); margin-left: auto; }
/* Меню действий записи гостевой книги (три точки) */
.reaction-menu { position: relative; }
.reaction-menu .reaction-menu-btn { padding: 4px 6px; }
.reaction-card-top .reaction-menu { margin-left: 0; }
.reaction-text { font-size: 0.95rem; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; color: var(--text); }
.reaction-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}
.reaction-actions .btn-action-sm {
    padding: 2px 7px;
    font-size: 0.8rem;
    border: 1px solid var(--border, #e0e0e0);
    border-radius: 14px;
    background: var(--bg);
}
.reaction-actions .btn-action-sm:hover { background: var(--card-hover, rgba(0,0,0,0.04)); }
.reaction-actions .reaction-like-btn.active {
    color: #16a34a;
    border-color: #16a34a;
    background: rgba(22,163,74,0.08);
}
.reaction-actions .reaction-dislike-btn.active {
    color: #dc2626;
    border-color: #dc2626;
    background: rgba(220,38,38,0.08);
}
.reaction-actions .comment-likes-static { margin-right: 6px; }
.reaction-hidden-note {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.92rem;
}
.reaction-card-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.reaction-card-actions .btn { white-space: nowrap; }

/* Модалка «Реакции» (список с прокруткой и подгрузкой) */
.reactions-modal {
    width: 420px;
    max-width: 92vw;
}
.reactions-modal-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.reactions-modal-list {
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px;
    padding-bottom: 16px;
}
.reactions-modal-list .reaction-card {
    padding: 10px;
    margin-bottom: 6px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
}
.reactions-modal-list .reaction-card:last-child { margin-bottom: 0; }
.reactions-loading {
    padding: 18px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.reactions-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}




/* ===== Мобильная кнопка «События» + модалка сводки ===== */
/* По умолчанию (десктоп, где сайдбар виден) — кнопки «События» и «Кто онлайн» в шапке скрываем */
.nav-events-btn {
    display: none;
}
.nav-online-btn {
    display: none;
}
/* Модалка «События» — широкая на всех размерах */
.events-modal {
    width: 440px;
    max-width: 92vw;
}
.events-modal .notif-list {
    max-height: 77vh;
    overflow-y: auto;
}

/* ===== Нижний мобильный навбар («События» + «Кто онлайн») ===== */
/* Внутри верхней шапки остаёмся как на десктопе; нижний блок скрыт по умолчанию */
.nav-mobile-bottom {
    display: none;
}

@media (max-width: 768px) {
    /* Счётчик «Нас: N · Мы написали: M постов» — мелкий под логотипом, на мобильных тоже */
    .site-stats {
        font-size: 0.6rem;
    }
    /* Кнопки «События» и «Кто онлайн» убираем из верхней шапки — перенесены вниз */
    .site-nav .nav-events-btn,
    .site-nav .nav-online-btn,
    .site-nav .nav-chat-btn {
        display: none;
    }
    /* Нижний прилепленный навбар — показан как аналог sticky-header снизу */
    .nav-mobile-bottom {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        background: #2f3033; /* тёмно-серый фон панели */
        border-top: 1px solid var(--border);
        color: #ececec; /* светло-серый цвет иконок по умолчанию */
        padding: 13px 50px; /* высота панели ~60px: иконка 34px + 13px сверху/снизу; 50px — отступы от краёв */
        gap: 36px; /* увеличенные промежутки между иконками */
        align-items: center;
        justify-content: center; /* набор иконок по центру с равными gap-зазорами */
    }
    .nav-mobile-bottom .btn {
        color: #ececec; /* светло-светло-серая подсветка иконок/текста кнопок */
    }
    .nav-mobile-bottom .nav-events-btn,
    .nav-mobile-bottom .nav-online-btn {
        display: inline-block;
        flex: 0 0 auto;
    }
    /* Кнопка «Эфир» рупор: без рамки/фона/паддинга, крупная иконка */
    .nav-mobile-bottom .nav-events-btn {
        border: none;
        background: transparent;
        padding: 0;
        box-shadow: none;
    }
    .nav-mobile-bottom .nav-events-ico {
        display: block;
    }
    /* Кнопка «Новички» смайл: без рамки/фона/паддинга, крупная иконка */
    .nav-mobile-bottom .nav-newfaces-btn {
        border: none;
        background: transparent;
        padding: 0;
        box-shadow: none;
    }
    .nav-mobile-bottom .nav-newfaces-ico {
        display: block;
    }
    /* Кнопка «События» флаг: без рамки/фона/паддинга, крупная иконка */
    .nav-mobile-bottom .nav-contests-btn {
        border: none;
        background: transparent;
        padding: 0;
        box-shadow: none;
    }
    .nav-mobile-bottom .nav-contests-ico {
        display: block;
    }
    /* Кнопка «Кто онлайн» группа: без рамки/фона/паддинга, крупная иконка */
    .nav-mobile-bottom .nav-online-btn {
        border: none;
        background: transparent;
        padding: 0;
        box-shadow: none;
    }
    .nav-mobile-bottom .nav-online-ico {
        display: block;
    }
    /* Кнопка «Лучшее» огонь: без рамки/фона/паддинга, крупная иконка */
    .nav-mobile-bottom .nav-best-btn {
        border: none;
        background: transparent;
        padding: 0;
        box-shadow: none;
    }
    .nav-mobile-bottom .nav-best-ico {
        display: block;
    }
    /* Кнопка «Меню юзера» (профиль) — крупная иконка без рамки; распределяется
       равномерно через justify-content: space-between (без margin-left:auto) */
    .nav-mobile-bottom .nav-user-btn {
        border: none;
        background: transparent;
        padding: 0;
        box-shadow: none;
    }
    .nav-mobile-bottom .nav-user-ico {
        display: block;
    }
    /* На мобильных убираем кнопку-аватар юзера из верхней шапки (меню перенесено вниз).
       НЕ скрываем весь .header-user — внутри него живут #profile-backdrop и
       #profile-dropdown (модалка меню), их нельзя прятать display:none у родителя. */
    .header-avatar-wrapper {
        display: none;
    }
    /* Колокольчик уведомлений — прижат к правому краю шапки, белая иконка.
       Правый отступ .container оставляем (16px) — для гостя кнопка «Регистрация»
       не прилипает к краю, а стоит с тем же отступом, что лого «Дневничок» слева.
       Колокольчик компенсируем отрицательным margin, чтобы оставался вплотную к краю. */
    .notif-wrapper {
        margin-left: auto;
        margin-right: -16px; /* вплотную к правому краю (компенсация padding .container) */
        color: #ffffff; /* белая иконка */
    }
    .notif-wrapper .notif-bell {
        color: #ffffff; /* белая иконка колокольчика */
    }
    /* Опустить иконку колокольчика и бейдж-счётчик на 3px ниже */
    .notif-wrapper .notif-bell-ico {
        transform: translateY(3px);
    }
    .notif-wrapper .notif-count {
        display: block; /* цифра по центру через line-height == высоте бейджа */
        text-align: center;
        line-height: 18px; /* == высоте бейджа → центр кружка */
        align-items: unset;
        justify-content: unset;
    }
    /* ТОЛЬКО на главной (плитки): круглая плашка #9BCE00; позиция — базовые top:1px / right:-1px */
    .home-tiles .notif-wrapper .notif-count {
        border-radius: 50%;    /* плашка идеально круглая */
        background: #9BCE00;   /* жёлто-зелёный */
    }
    .home-tiles .notif-wrapper .notif-bell-ico {
        color: #ffffff;        /* белая иконка колокольчика (только на главной) */
    }
    /* Отступ внизу контента, чтобы прилепленный блок не перекрывал строки */
    .site-main {
        padding-bottom: 86px;
    }
    /* Футер тоже не прячем под нижним блоком */
    .site-footer {
        padding-bottom: 98px;
    }
    /* Мобильная модалка «События» — вся ширина экрана минус 5px с каждой стороны */
    /* Адаптивная ширина: весь экран минус 10px с каждой стороны, но не шире 440px */
    .events-modal,
    .online-modal,
    .newfaces-modal,
    .contests-modal,
    .notif-modal,
    .pm-modal {
        width: calc(100vw - 20px);
        max-width: 440px;
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%);
        max-height: 96.8vh;
    }

    /* Окно на мобиле: высота = экран минус нижняя липкая панель, чтобы окно
       не уезжало под неё. Считаем через dvh (а не vh): в мобильных Safari vh
       не учитывает прячущуюся адресную строку и окно вылезало за экран.
       Панель ~61px (иконка 34 + паддинг 13×2 + рамка 1) — берём 64px с запасом. */
    .notif-modal {
        /* Высота окна ЛС уменьшена на 10% по просьбе юзера (14.09.26).
           Центр окна задан через top + translate(-50%,-50%) и от высоты НЕ зависит,
           поэтому уменьшение уходит симметрично: поровну вверх и вниз. */
        max-height: calc((100dvh - 64px - 4px) * 0.9);
        top: calc((100dvh - 64px) / 2);
    }
    .notif-modal .notif-pane--msgs { min-height: 0; }
    .notif-modal .pm-convo-main { min-height: 0; }
    /* Тред обязан УМЕТЬ сжиматься: базовое правило .pm-body (min-height:260px,
       max-height:52vh) на коротком экране телефона не давало окну уложиться —
       тред распирал модалку, и поле ввода уезжало за границы окна. */
    .notif-modal .pm-body {
        min-height: 0;
        max-height: none;
        flex: 1 1 auto;
    }
    /* Поле ввода не сжимаем — оно всегда должно быть видно целиком. */
    .notif-modal .pm-input-row { flex: 0 0 auto; }
    /* Список уведомлений тоже должен ужиматься, а не распирать окно:
       базовый .notif-list имеет max-height:400px и при высоком окне ок. */
    .notif-modal .notif-pane { min-height: 0; overflow: hidden; }
    .notif-modal .notif-list { flex: 1 1 auto; min-height: 0; }

    /* Колонка собеседников на мобиле — горизонтальная лента сверху
       (вертикальная полоса 64px съедала бы треть и без того узкого экрана). */
    .notif-pane--msgs { flex-direction: column; }
    .pm-convo-rail {
        flex: 0 0 auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
        overflow-y: hidden;
    }
    .pm-convo-list {
        flex-direction: row;
        gap: 8px;
        padding: 8px;
    }
    .pm-convo-item { width: 40px; height: 40px; }
    .pm-convo-av { width: 40px; height: 40px; font-size: 0.9rem; }
    .pm-convo-av.is-online::after { width: 9px; height: 9px; }
    .pm-convo-empty { padding: 8px 4px; white-space: nowrap; }

    /* 24.08: Эфир на мобиле — внутренние отступы x2 (было 12px) и интервал между
       событиями x2 (padding 5px -> 10px вертикально) */
    .events-modal .notif-list {
        padding: 24px 16px;
    }
    .events-modal .activity-item {
        padding: 10px;
    }
    /* 14.09.26: линию над «Эфиром» убирали только для десктопа (правка у базового
       .sidebar-activity) — на мобиле возвращаем разделитель: там «Эфир» живёт в
       модалке вместе с другими блоками, и граница нужна для отделения. */
    .sidebar-activity:has(#activity-list) {
        border-top: 1px solid var(--border);
    }
}

/* Модалка наград (медали / звёзды) */
.rewards-modal { max-width: 420px; }
.rewards-modal .rewards-modal-list {
    max-height: 60vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.rewards-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(0,0,0,0.03);
    color: var(--text, #222);
    text-decoration: none;
    font-size: 0.9rem;
}
a.rewards-item:hover { background: rgba(0,0,0,0.06); color: var(--accent, #e0245e); }
.rewards-item-medal { cursor: default; }
.rewards-ico { font-size: 1.2rem; flex: 0 0 auto; }
.rewards-txt { flex: 1; }
.rewards-date { color: var(--text-muted, #888); font-style: normal; font-size: 0.8rem; margin-left: 6px; }
.rewards-empty { padding: 16px; text-align: center; color: var(--text-muted, #888); }
.profile-medal { cursor: pointer; }
.author-star { cursor: pointer; }

/* Звезда «Лучший пост недели» в шапке поста — заметная */
.best-star-header {
    font-size: 1.25rem;
    color: #f5c514;
    margin-left: 2px;
    text-shadow: 0 0 6px rgba(245,197,20,0.5);
}

/* === Quill 2 редактор — тёмная тема === */
.editor-wrap .ql-toolbar.ql-snow {
    border: 1px solid var(--border, #444);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    background: var(--bg-card, #1c1c1c);
}
.editor-wrap .ql-container.ql-snow {
    border: 1px solid var(--border, #444);
    border-top: none;
    border-radius: 0 0 8px 8px;
    font-size: 0.95rem;
}
.editor-wrap .ql-editor {
    min-height: 220px;
    background: var(--bg, #181818);
    color: var(--text, #e0e0e0);
}
.editor-wrap .ql-snow .ql-stroke { stroke: var(--text-muted, #bbb); }
.editor-wrap .ql-snow .ql-fill { fill: var(--text-muted, #bbb); }
.editor-wrap .ql-snow .ql-picker { color: var(--text, #e0e0e0); }
.editor-wrap .ql-snow .ql-picker-options { background: var(--bg-card, #1c1c1c); color: var(--text, #e0e0e0); }
.editor-wrap .ql-snow.ql-toolbar button:hover,
.editor-wrap .ql-snow.ql-toolbar button:focus,
.editor-wrap .ql-snow.ql-toolbar button.ql-active {
    background: rgba(255,255,255,0.08);
}
.editor-wrap .ql-editor img { max-width: 100%; }
.editor-wrap .ql-editor.ql-blank::before {
    color: var(--text-muted, #888);
    font-style: italic;
}

/* === Эмодзи в Quill-редакторе ===
   Вендорный quill2-emoji.css задаёт вставленному смайлику
   `.ap { font-size:20px; line-height:1; overflow:hidden }` — бокс 20px, а глиф
   (Segoe UI Emoji на Windows) рисуется выше/ниже этих 20px → нижняя часть смайлика
   обрезается. Даём контейнеру больше высоты и не режем глиф. */
.editor-quill .ql-editor .ql-emojiblot {
    vertical-align: baseline;              /* по базовой линии, а не прижато к text-top */
}
.editor-quill .ql-editor .ql-emojiblot .ap {
    overflow: visible;                     /* не обрезать глиф по низу */
    line-height: 1.3;                      /* контейнер выше — хватает места под смайлик */
}

/* === Видео в постах и редакторе ===
   В ПОСТАХ (лента): плеер фиксированной ширины 500px (не шире контейнера).
   В РЕДАКТОРЕ: на всю ширину текста. */
.ql-editor video {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 8px 0;
    border-radius: 8px;
    background: #000;
    aspect-ratio: 16 / 9;
    object-fit: contain;
}
/* Аудио в редакторе: плеер на всю ширину текста */
.ql-editor audio {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 54px;   /* иначе <audio controls> может схлопнуться в 0 из-за display:block */
    margin: 8px 0;
}
.comment-body video {
    display: block;
    width: 500px;
    max-width: 100%;
    height: auto;
    margin: 8px 0;   /* по левому краю (как текст) */
    border-radius: 8px;
    background: #000;
    aspect-ratio: 16 / 9;
    object-fit: contain;
}

/* === Индикатор загрузки (upload) — спиннер-оверлей === */
.upload-loader {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    color: #fff;
    font-size: 0.95rem;
}
.upload-spinner {
    width: 46px;
    height: 46px;
    border: 4px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: upload-spin 0.9s linear infinite;
}
.upload-loader-text {
    text-align: center;
    padding: 0 20px;
}
@keyframes upload-spin { to { transform: rotate(360deg); } }

/* Звёздочка обязательного поля */
.required-mark { color: #e0245e; margin-left: 2px; }

/* Подпись «необязательно» у поля (регистрация, аккаунт) */
.required-optional { color: var(--text-muted, #8899a6); font-size: 0.85em; font-weight: normal; }
/* Ссылка «Забыли пароль?» на странице входа */
.auth-forgot { text-align: center; margin: 12px 0 0; font-size: 0.9em; }
.auth-forgot a { color: var(--primary, #7c6cf0); text-decoration: none; }
.auth-forgot a:hover { text-decoration: underline; }

/* ========================================
   ЛЕНТА — ЛЁГКАЯ СОВРЕМЕННАЯ ЛЕНТА
   Применяется только на главной странице
   ======================================== */

.feed-page {
    animation: feedFadeIn 0.4s ease-out;
}

@keyframes feedFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Заголовок ленты --- */
.feed-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.feed-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    margin: 0;
}

.feed-sort-switch {
    margin-left: auto;
}

/* --- Карточка поста в ленте --- */
.feed-page .post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px 0;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.feed-page .post-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
    transform: translateY(-2px);
    border-color: var(--primary);
}

/* --- Шапка карточки --- */
.feed-page .post-card .post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    position: relative;
    flex-wrap: nowrap;
}

.feed-page .post-card .avatar-wrapper {
    flex-shrink: 0;
}

.feed-page .post-card .avatar-wrapper img {
    width: 96px;
    height: 96px;
    border-radius: 16px;
    object-fit: cover;
    transition: transform 0.2s;
}

.feed-page .post-card:hover .avatar-wrapper img {
    transform: scale(1.05);
}

.feed-page .post-card .post-author-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    transition: color 0.15s;
}

.feed-page .post-card .post-author-name:hover {
    color: var(--primary);
}

.feed-page .post-card .post-stat {
    font-size: 0.675rem; /* = .post-time (дата поста) на ленте */
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 6px;
}

.feed-page .post-card .post-time {
    font-size: 0.675rem;
    color: var(--text-muted);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.feed-page .post-card .best-star {
    font-size: 1.1rem;
    filter: drop-shadow(0 0 2px rgba(245,197,20,0.4));
}

.feed-page .post-card .edited-icon {
    font-size: 0.8rem;
    opacity: 0.5;
}

/* --- Тело поста --- */
.feed-page .post-card .post-body {
    margin-bottom: 0;
}

.feed-page .post-card .post-title-link {
    display: block;
    color: var(--text);
    font-size: calc(1.4rem - 1px);   /* заголовок поста в ленте, уменьшен на 1px */
    font-weight: 800;
    line-height: 1.35;
    margin-bottom: 70px;
    letter-spacing: -0.04em;
    transition: color 0.15s;
}

.feed-page .post-card .post-title-link:hover {
    color: var(--primary);
}

.feed-page .post-card .post-preview {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 14px;
    cursor: pointer;
    transition: color 0.15s;
}

.feed-page .post-card .post-preview:hover {
    color: var(--text);
}

/* --- Раскрытый контент поста --- */
.feed-page .post-card .post-content-collapsible .post-text {
    font-size: 1rem;
    line-height: 1.30;
    color: var(--text);
}

/* --- Футер карточки (кнопки действий) --- */
.feed-page .post-card .post-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.feed-page .post-card .btn-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border: none;
    border-radius: 999px;
    background: var(--bg);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.15s;
    font-family: inherit;
    font-weight: 500;
}

.feed-page .post-card .btn-action:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: scale(1.05);
}

.feed-page .post-card .btn-action.active {
    background: var(--primary);
    color: #fff;
}

.feed-page .post-card .btn-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.feed-page .post-card .btn-action .count {
    font-weight: 600;
    color: inherit;
}

/* --- Рейтинг в футере --- */
.feed-page .post-card .post-rating {
    margin-left: auto;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
    background: var(--bg);
}

.feed-page .post-card .post-rating.positive {
    color: var(--rating-positive);
    background: #f0fdf4;
}

.feed-page .post-card .post-rating.negative {
    color: var(--rating-negative);
    background: #fef2f2;
}

.feed-page .post-card .post-rating.neutral {
    color: var(--rating-neutral);
    background: #f5f5f5;
}

/* --- Ссылка на раздел в футере --- */
.feed-page .post-card .post-section-link {
    font-size: 0.8rem;
    color: var(--primary);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--primary-light);
    transition: background 0.15s;
}

.feed-page .post-card .post-section-link:hover {
    background: var(--primary);
    color: #fff;
}

/* --- Кнопка меню поста --- */
.feed-page .post-card .btn-icon.post-menu-btn {
    font-size: 2.1rem;
    padding: 2px 8px;
    line-height: 1;
    border-radius: 8px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.feed-page .post-card .btn-icon.post-menu-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text);
}

/* --- Онлайн-точка --- */
.feed-page .post-card .online-dot {
    width: 20px;
    height: 20px;
    bottom: 2px;
    right: 2px;
    border-width: 3px;
}

/* --- Пустая лента --- */
.feed-page .feed-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.feed-page .feed-empty a {
    color: var(--primary);
    font-weight: 600;
}

/* --- Кнопка "Создать запись" --- */
.feed-page ~ header .btn-primary,
header .btn-primary {
    border-radius: 999px;
    padding: 8px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    box-shadow: 0 2px 8px rgba(37,99,235,0.25);
    transition: box-shadow 0.2s, transform 0.15s;
}

.feed-page ~ header .btn-primary:hover,
header .btn-primary:hover {
    box-shadow: 0 4px 16px rgba(37,99,235,0.35);
    transform: translateY(-1px);
}

/* --- Toggle switch (развернуть/свернуть) --- */
.feed-page .toggle-switch {
    gap: 10px;
}

.feed-page .toggle-label {
    font-size: 0.85rem;
    font-weight: 500;
}

.feed-page .toggle-slider {
    width: 40px;
    height: 22px;
    border-radius: 11px;
}

.feed-page .toggle-slider::after {
    width: 18px;
    height: 18px;
    top: 2px;
    left: 2px;
}

.feed-page .toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(18px);
}

/* --- Кнопки в сайдбаре --- */
header .btn.btn-sm {
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: background 0.15s;
}

/* ========================================
   МОБИЛЬНАЯ ВЕРСИЯ ЛЕНТЫ
   ======================================== */
@media (max-width: 768px) {
    .feed-page .post-card {
        padding: 16px 0;
        border-radius: 12px;
        margin-bottom: 12px;
    }

    .feed-page .post-card:hover {
        transform: none;
    }

    .feed-page .post-card .post-header {
        gap: 10px;
    }

    .feed-page .post-card .post-title-link {
        font-size: calc(1.2rem - 1px);   /* уменьшен на 1px */
        font-weight: 800;
        margin-bottom: 40px;
    }

    .feed-page .post-card .post-preview {
        font-size: 0.92rem;
    }

    .feed-page .post-card .btn-action {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    .feed-header {
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

    .feed-header h1 {
        font-size: 1.3rem;
    }
}

/* ========================================
   SVG ИКОНКИ — ОДНОТОЧЕЧНЫЕ
   ======================================== */

.icon,
svg.icon {
    display: inline-block;
    width: 1.25em;
    height: 1.25em;
    vertical-align: -0.125em;
    flex-shrink: 0;
    color: inherit;
}

/* Иконки в кнопках действий — чуть крупнее */
.btn-action svg.icon {
    width: 1.45em;
    height: 1.45em;
}

/* Лайк (плюс в кружочке) — hover/active бледно-зелёный */
.feed-page .btn-like:hover,
.feed-page .btn-like.active {
    color: #4caf50 !important;
    background: rgba(76,175,80,0.08) !important;
}
.feed-page .btn-like:hover svg.icon,
.feed-page .btn-like.active svg.icon {
    color: #4caf50 !important;
}

/* Дизлайк (минус в кружочке) — hover/active бледно-пурпурный */
.feed-page .btn-dislike:hover,
.feed-page .btn-dislike.active {
    color: #ce93d8 !important;
    background: rgba(206,147,216,0.08) !important;
}
.feed-page .btn-dislike:hover svg.icon,
.feed-page .btn-dislike.active svg.icon {
    color: #ce93d8 !important;
}

/* Страница поста: иконки +/- и комментарии — как на главной (пилюли + кружочки) */
.post-full .post-footer .btn-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border: none;
    border-radius: 999px;
    background: var(--bg);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.15s;
    font-family: inherit;
    font-weight: 500;
    text-decoration: none;
}
.post-full .post-footer .btn-action:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: scale(1.05);
}
.post-full .post-footer .btn-action.active {
    background: var(--primary);
    color: #fff;
}
.post-full .post-footer .btn-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}
.post-full .post-footer .btn-action .count {
    font-weight: 600;
    color: inherit;
}
.post-full .btn-like:hover,
.post-full .btn-like.active {
    color: #4caf50 !important;
    background: rgba(76,175,80,0.08) !important;
}
.post-full .btn-like:hover svg.icon,
.post-full .btn-like.active svg.icon {
    color: #4caf50 !important;
}
.post-full .btn-dislike:hover,
.post-full .btn-dislike.active {
    color: #ce93d8 !important;
    background: rgba(206,147,216,0.08) !important;
}
.post-full .btn-dislike:hover svg.icon,
.post-full .btn-dislike.active svg.icon {
    color: #ce93d8 !important;
}

/* Корона на аватаре */
.avatar-crown svg.icon {
    width: 22px;
    height: 22px;
    color: #ffd700;
}

/* Лучший пост — звёздочка */
.best-star svg.icon {
    width: 22px;
    height: 22px;
    color: #f5a623;
}

/* Иконка редактирования */
.edited-icon svg.icon {
    width: 17px;
    height: 17px;
    color: var(--text-light, #8899a6);
}

/* Иконки в выпадающем меню */
.post-menu button svg.icon {
    width: 19px;
    height: 19px;
    margin-right: 6px;
    vertical-align: middle;
}

/* Просмотры */
.post-stat svg.icon {
    width: 12px !important;
    height: 12px !important;
    color: var(--text-light, #8899a6);
    vertical-align: -5px;
}

/* Иконка приватности в футере */
.post-privacy-icon svg.icon {
    width: 20px;
    height: 20px;
    color: var(--text-light, #8899a6);
}

/* Раздел */
.post-section-link svg.icon {
    width: 17px;
    height: 17px;
    color: var(--primary);
    margin-right: 3px;
}

/* === ВРЕМЕННОЕ скрытие чата (блок сайдбара + кнопки «Чат») === */
.nav-chat-btn,
.sidebar-chat-preview {
    display: none !important;
}

/* ===== Защита от горизонтального переполнения на мобильных =====
   Не даём контенту (длинным фото/видео/неразрывным строкам) растянуть
   сайт шире экрана — особенно внутри модалок комментариев/редакторов. */
html,
body {
    overflow-x: clip;   /* clip не создаёт scroll-context; sticky/модалки работают */
}

/* Изображения/видео в контенте — не выходят за ширину контейнера */
.ql-editor img,
.post-text img,
.post-text video,
.comment-body img,
.comment-body video,
.post-content-collapsible img {
    max-width: 100% !important;
    height: auto;
}
/* iframe (плееры) — только max-width, высоту НЕ трогаем */
.post-text iframe,
.comment-body iframe,
.ql-editor iframe {
    max-width: 100% !important;
}
.comment-body .post-video iframe,
.ql-editor .post-video iframe {
    height: 100%; /* плеер заполняет контейнер .post-video (иначе схлопнется) */
}

/* Длинные непрерывные строки (URL и т.п.) — переносим, чтобы не расширяли документ */
.ql-editor,
.post-text,
.comment-body,
.post-content-collapsible {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ===== Предотвращение мобильного авто-зума при фокусе на поле ввода =====
   iOS Safari/Android zoom'ят страницу, если font-size поля ввода < 16px.
   Ставим 16px на все поля ввода (включая Quill-редактор) на мобильных. */
@media (max-width: 768px) {
    /* Никнеймы на мобильном: уменьшены и уплотнены (интервалы между буквами/строками) */
    .profile-nickname {
        font-size: 0.75rem;      /* 24px → 12px (в 2 раза) */
        line-height: 1.15;
        letter-spacing: -0.015em;
    }
    .reaction-author {
        font-size: 0.75rem;      /* 16px → 12px */
        line-height: 1.2;
        letter-spacing: -0.01em;
    }
    input[type="text"],
    input[type="password"],
    input[type="number"],
    input[type="email"],
    input[type="search"],
    textarea,
    .ql-editor,
    .ql-editor * {
        font-size: 16px !important;
    }
    /* Не расширяем документ при появлении фокуса/клавиатуры */
    html,
    body {
        overflow-x: clip;
    }
}

/* === Гостевая книга === */
.gbook-page .reactions-header { align-items: center; }
.reaction-count.neutral { color: var(--text-muted, #6b7280); }
.reaction-count.neutral .icon-svg { color: var(--text-muted, #6b7280); }

/* Хозяин книги — крупный аватар сверху (как на странице юзера) */
.gbook-owner {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}
.gbook-owner .avatar-wrapper {
    flex-shrink: 0;
}
.gbook-owner-meta h1 {
    font-size: 1.35rem;
    letter-spacing: -0.02em;
    margin: 0;
    word-break: break-word;
}
.gbook-owner .avatar-128 {
    border-radius: 16px;               /* мягкое скругление крупного аватара */
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    border: 2px solid var(--card-bg, #fff);
}

.gbook-form {
    border: 1px solid var(--border, rgba(0,0,0,0.06));
    border-radius: 14px;
    background: var(--card-bg, rgba(255,255,255,0.7));
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.gbook-form .editor-quill {
    border: 1px solid var(--border, #e0e0e0);
    border-radius: 10px;
    background: var(--bg, #fff);
}
.gbook-note {
    font-size: 0.85rem;
    color: var(--text-muted, #666);
    margin: 12px 0 10px;
}
.gbook-type-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.gbook-type-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border, rgba(0,0,0,0.08));
    background: var(--bg, #fff);
    color: var(--text-muted, #555);
    border-radius: 10px;
    padding: 7px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s ease;
}
.gbook-type-btn .icon-svg { display: block; }
.gbook-type-btn:hover { background: var(--card-hover, rgba(0,0,0,0.04)); color: var(--text); }
.gbook-type-btn.vote-sympathy.active {
    color: #16a34a;
    border-color: rgba(22,163,74,0.4);
    background: rgba(22,163,74,0.1);
    font-weight: 600;
}
.gbook-type-btn.vote-antipathy.active {
    color: #dc2626;
    border-color: rgba(220,38,38,0.4);
    background: rgba(220,38,38,0.1);
    font-weight: 600;
}
.gbook-type-btn.vote-neutral.active {
    color: var(--text);
    border-color: var(--border-strong, rgba(0,0,0,0.2));
    background: var(--bg-subtle, rgba(0,0,0,0.05));
    font-weight: 600;
}
.gbook-login-hint {
    color: var(--text-muted, #666);
    font-size: 0.9rem;
    margin: 8px 0 16px;
}
.gbook-anon-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted, #666);
    margin: 0 0 12px;
    cursor: pointer;
}
.reaction-anon-author {
    color: #9aa0a6;
    font-style: italic;
}
.reaction-anon-avatar {
    opacity: 0.55;
    filter: grayscale(1);
}
.post-anon-avatar {
    opacity: 0.6;
    filter: grayscale(1);
}
.post-anon-name {
    color: #9aa0a6;
    font-style: italic;
}
.post-anon-checkbox {
    margin: 4px 0 0;
}

/* Подсказка «Отредактировано» при тапе (мобильные) */
.edited-icon {
    cursor: pointer;
}
.edited-icon.active {
    opacity: 1;
    color: var(--accent, #1da1f2);
}
.edited-tooltip {
    position: fixed;
    z-index: 6000;
    max-width: 82vw;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--tooltip-bg, #1c2733);
    color: var(--tooltip-fg, #e8f0fe);
    font-size: 0.75rem;
    line-height: 1.35;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.edited-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}
@media (max-width: 768px) {
    .edited-tooltip { white-space: normal; text-align: center; }
}

/* ============================================================
   ЖЁЛТЫЙ ШИЛЬДИК-ШЕСТЕРЁНКА (моб) + окно быстрых настроек
   Шильдик: 50×50, справа по центру экрана, жёлтый #f5c514.
   По клику справа ВЫЕЗЖАЕТ модалка на центр экрана с тёмно-серым фоном.
   ============================================================ */
/* --- Шильдик: показываем и на мобильном (50×50), и на десктопе (100×100) --- */
.settings-fab {
    display: flex;
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    padding: 0;
    border: none;
    border-left: none;
    background: #f5c514;
    color: #111;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 150;                 /* выше контента/нижнего навбара, ниже модалок */
    border-radius: 9px 0 0 9px;  /* скругление уменьшено вслед за размером кнопки */
    box-shadow: -5px 5px 18px rgba(0,0,0,0.25);
    opacity: 0.9;                 /* прозрачность снижена (было 0.4/0.6/0.8) */
    -webkit-tap-highlight-color: transparent;
}
.settings-fab:active { opacity: .85; }
.settings-fab svg { width: 23px; height: 23px; stroke-width: 1.2; }
/* Десктоп — крупная кнопка (базовые размеры выше уже 100×100) */

/* --- Модалка: тёмно-серый фон, выезжает справа в центр --- */
#settings-modal-backdrop {
    background: rgba(0,0,0,0.5);
}
.settings-modal {
    background: #2b2b31;          /* тёмно-серый фон окна */
    color: #fff;
    border-radius: 14px;
    max-width: 340px;
    width: calc(100vw - 32px);
    overflow: hidden;
}
.settings-modal .modal-header {
    background: rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: #fff;
}
.settings-modal .modal-close { color: #fff; }
.settings-modal-body {
    padding: 10px;
    max-height: 72vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.settings-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 12px;
    border-radius: 10px;
    color: #f1f1f1;
    font-size: 1rem;
    text-decoration: none;
    transition: background .15s ease;
}
.settings-row + .settings-row { margin-top: 2px; }
.settings-row:active { background: rgba(255,255,255,0.08); }
.settings-row-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: #f5c514;               /* жёлтый акцент иконок */
    flex: 0 0 auto;
}
.settings-row-icon svg { width: 18px; height: 18px; }
.settings-row-danger { color: #ff9b9b; }
.settings-row-danger .settings-row-icon { color: #ff9b9b; }

/* --- Секция «Сортировать записи» + переключатель (По новизне / По рейтингу) --- */
.settings-section {
    padding: 2px 4px 12px;
}
.settings-section-title {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: rgba(255,255,255,0.55);
    font-weight: 700;
    margin: 4px 8px 10px;
}
.settings-segmented {
    display: flex;
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 3px;
    gap: 3px;
}
.settings-seg-btn {
    flex: 1 1 50%;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.7);
    font-size: .95rem;
    font-weight: 600;
    padding: 11px 8px;
    border-radius: 9px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .18s ease, color .18s ease;
}
.settings-seg-btn.is-active {
    background: #f5c514;          /* жёлтый — активный вариант */
    color: #111;
    font-weight: 700;
}
.settings-seg-btn:active { transform: scale(.97); }

/* --- «+» Создать запись --- */
.settings-add {
    margin-top: 4px;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 14px;
    font-weight: 600;
}
.settings-add-icon {
    width: 24px;
    height: 24px;
    font-size: 1.3rem;
    line-height: 1;
    color: #111;
    background: #f5c514;
    border-radius: 8px;
    font-weight: 700;
    justify-content: center;
}

/* --- Анимация: выезд справа на центр стола (только для этого окна) --- */
@keyframes settings-in {
    0%   { opacity: 0; transform: translate(calc(-50% + 100vw), -50%); }
    100% { opacity: 1; transform: translate(-50%, -50%); }
}
.settings-modal { animation: settings-in .34s cubic-bezier(.22,.7,.3,1) both; }

/* --- Анимация закрытия: окно уезжает вправо обратно в жёлтую иконку --- */
@keyframes settings-out {
    0%   { opacity: 1; transform: translate(-50%, -50%); }
    100% { opacity: 0; transform: translate(calc(-50% + 100vw), -50%); }
}
.settings-modal.settings-closing { animation: settings-out .32s cubic-bezier(.55,.06,.68,.19) both; }

/* Мобильный — компактный шильдик 50×50 (десктоп: базовые 100×100) */
@media (max-width: 768px) {
    .settings-fab {
        width: 38px;
        height: 38px;
        border-radius: 10px 0 0 10px;
        box-shadow: -3px 3px 10px rgba(0,0,0,0.22);
    }
    .settings-fab svg { width: 18px; height: 18px; stroke-width: 1.2; }
}

/* ===== Конкурсы ===== */
.contest-chips {
    display: inline-flex; align-items: center; gap: 4px;
    background: rgba(124,108,240,.15); color: #c9c2ff;
    border: 1px solid rgba(124,108,240,.4);
    border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600;
    text-decoration: none; white-space: nowrap; margin-left: 6px;
}
.contest-chip-this:hover { background: rgba(124,108,240,.28); }
.contest-chip-on {
    display: inline-flex; align-items: center;
    background: rgba(250,204,21,.12); color: #ffd86b;
    border: 1px solid rgba(250,204,21,.35);
    border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600;
    white-space: nowrap; margin-left: 6px;
    text-decoration: none;
}
a.contest-chip-on:hover { background: rgba(250,204,21,.25); color: #ffe08a; }
.contest-win-badge {
    display: inline-flex; align-items: center; gap: 4px;
    background: rgba(255,215,0,.15); color: #ffd34d;
    border: 1px solid rgba(255,215,0,.45);
    border-radius: 999px; padding: 1px 10px; font-size: 12px; font-weight: 700;
    white-space: nowrap; margin-left: 6px;
}

/* Медаль/иконка победителя в шапке призовой работы (справа от автора). */
.contest-win-medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    flex-shrink: 0;
    line-height: 1;
    margin-left: 6px;
}
.contest-win-medal--img img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.contest-win-medal--place {
    font-size: 45px;
    width: 60px;
    height: 60px;
    line-height: 60px;
}
.contest-info-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    width: 100%; margin-top: 10px; padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.contest-remain { color: #9ed7ff; font-size: 13px; font-weight: 400; white-space: nowrap; }
.contest-remain--end { flex: 0 0 100%; margin-bottom: 30px; }
.contest-remain--big { font-size: 14px; font-weight: 600; }
.contest-finished-label {
    color: #8a8a95; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.btn-contest-join { border-color: rgba(124,108,240,.5); color: #c9c2ff; }
.btn-contest-join.active { background: rgba(124,108,240,.25); border-color: #7c6cf0; color: #fff; }
.btn-battle-watch { border-color: rgba(56,189,248,.5); color: #a8e1ff; }
.btn-battle-watch.active { background: rgba(56,189,248,.25); border-color: #38bdf8; color: #fff; }
.btn-contest-members, .btn-contest-entries { color: #cbd5e1; }

/* Полная панель конкурса на странице поста */
.contest-full-panel {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    width: 100%; margin-top: 12px; padding: 12px;
    background: rgba(0,0,0,.18); border-radius: 12px;
}
.contest-full-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

/* Модалка участников */
.participants-modal { width: 420px; max-width: 92vw; }
.contest-participants-list {
    max-height: 55vh; overflow-y: auto; padding: 10px 12px;
}
.participant-row {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 4px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.participant-row a { color: #000; text-decoration: none; font-weight: 500; }
.participant-row a:hover { color: #000; }
.participants-more { width: 100%; margin-top: 10px; }

/* Страница конкурса (лента работ) */
.contest-page-head {
    display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; justify-content: space-between;
    padding: 0 0 18px 0; margin-bottom: 22px;
    background: transparent; border: none; border-radius: 0;
    border-bottom: 1px solid #e0e0e0;
}
.contest-page-badge {
    display: inline-block; background: rgba(124,108,240,.12); color: #5b4fd8;
    border: 1px solid rgba(124,108,240,.35); border-radius: 999px;
    padding: 2px 11px; font-size: 12px; font-weight: 700; margin-bottom: 8px;
}
.contest-page-title h1 { margin: 0 0 6px; font-size: 24px; }
.contest-page-title h1 a { color: var(--text); text-decoration: none; }
.contest-page-title h1 a:hover { color: var(--primary); }
.contest-page-author { margin: 0; color: #555; font-size: 13px; }
.contest-page-author a { color: var(--primary); text-decoration: none; }
.contest-page-meta { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.contest-page-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.contest-entries-head h2 { margin: 0 0 20px; font-size: 18px; }

/* Работы конкурса — карточки как на странице поста: белые, без рамки, линия-разделитель. */
body.post-page .contest-page .feed-page .post-card {
    background: transparent; border: none; box-shadow: none; border-radius: 0;
    border-bottom: 1px solid #e0e0e0; padding-bottom: 36px;
}
body.post-page .contest-page .feed-page .post-card:hover {
    transform: none; box-shadow: none; border-color: transparent;
}
body.post-page .contest-page .feed-page .post-card:hover .avatar-wrapper img { transform: none; }

/* Строка «Работа на конкурс» внизу поста-работы (ссылка на страницу конкурса /contest/{id}) */
.post-contest-work {
    margin-top: 18px; padding-top: 12px; margin-bottom: 50px;
    border-top: 1px solid #e0e0e0;
    font-size: 13px; color: #555;
}
.post-contest-work a { color: var(--primary); text-decoration: none; }
.post-contest-work a:hover { text-decoration: underline; }
/* В карточках ленты (главная/профиль/поиск) — тоже 50px, как на странице поста */
.post-card .post-contest-work { margin-bottom: 50px; }

/* Работа конкурса, скрытая приватностью: шапка+заголовок видны, тело — надпись */
.post-card--hidden .post-hidden-privacy {
    margin: 14px 0 4px;
    padding: 14px 16px;
    background: #fafbfc;
    border: 1px dashed #d0d5dc;
    border-radius: 10px;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.5;
}
/* Подсказка о времени голосования вместо кнопок лайк/дизлайк на работе конкурса (до голосования) */
.contest-vote-hint {
    display: inline-flex; align-items: center;
    color: #6b7280; font-size: 12px; line-height: 1.4;
    white-space: normal; padding: 4px 2px;
}
.post-full .post-footer .contest-vote-hint,
.feed-page .post-card .post-footer .contest-vote-hint { flex: 1 1 auto; }
/* Итоговый рейтинг работы на странице конкурса после завершения (кнопки скрыты) */
.contest-rating-summary {
    display: inline-flex; align-items: center;
    color: var(--text); font-weight: 600; font-size: 13px;
    white-space: nowrap; padding: 4px 2px;
}
.post-full .post-footer .contest-rating-summary,
.feed-page .post-card .post-footer .contest-rating-summary { flex: 1 1 auto; }

@media (max-width: 600px) {
    .contest-page-meta { align-items: flex-start; }
    .contest-page-actions { justify-content: flex-start; }
    .contest-full-actions { margin-left: 0; }
}

/* Бейджи на плитках */
.tile-contest-badge {
    position: absolute; top: 10px; left: 10px; z-index: 3;
    padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
    background: rgba(124,108,240,.85); color: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.tile-contest-badge--on { background: rgba(250,204,21,.85); color: #221a00; }

/* Чекбокс «анонимно» при включённом конкурсе — неактивен */
.post-anon-checkbox.disabled { opacity: .5; pointer-events: none; }
.contest-anon-hint { color: #f0a35b; font-size: 12px; margin-top: 4px; }

/* Выбор окончания конкурса: срок (дни) + час (24-ч) */
.contest-end-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.contest-end-field { display: flex; flex-direction: column; gap: 4px; }
.contest-end-field select {
    background: rgba(255,255,255,.06); color: #e5e7eb; border: 1px solid rgba(255,255,255,.18);
    border-radius: 8px; padding: 7px 10px; font-size: 14px; min-width: 140px;
}
.contest-end-field select:focus { outline: none; border-color: #7c6cf0; }
.contest-end-label { font-size: 12px; color: #9ca3af; }
.required-mark { color: #ff6b6b; }

/* Компактный межбуквенный интервал у никнеймов на сайте (2026-08).
   Уменьшаем расстояние между буквами в выводе имени пользователя. */
.post-author-name,
.comment-author-name,
.comment-guest-name,
.dropdown-nickname,
.dropdown-username,
.profile-nickname,
.best-author-name,
.best-author-un,
.newface-name,
.newface-modal-name,
.online-modal-name,
.newface-row .newface-name {
    letter-spacing: -0.02em;
}

/* Онлайн-индикатор на аватарке комментатора (небольшой зелёный дот в углу) */
.comment-online-dot {
    width: 10px;
    height: 10px;
    bottom: 0;
    right: 0;
    border: 2px solid var(--bg-card);
}

/* =====================================================
   Страница поста и главная лента (НЕ плитки): белый фон
   и убранные серые бордеры/обводки.
   Скоуп на body.post-page / body.feed-home — плитки и
   другие страницы не затрагиваются.
   ===================================================== */
body.post-page,
body.feed-home { background: #ffffff; }
body.post-page .site-main,
body.feed-home .site-main,
body.post-page .content-main,
body.feed-home .content-main { background: transparent; }

/* Карточки без серой обводки и на белом */
body.post-page .post-full,
body.feed-home .feed-page .post-card,
body.post-page .comments-section {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
}
/* Сплошная светло-серая линия-разделитель под каждым постом */
body.post-page .post-full,
body.feed-home .feed-page .post-card {
    border-bottom: 1px solid #e0e0e0 !important;
}
/* Пробел над линией-разделителем +50% (от базового padding-bottom) */
body.post-page .post-full { padding-bottom: 36px !important; }
body.feed-home .feed-page .post-card { padding-bottom: 43px !important; }
/* Сайдбар обеих страниц — на белом */
body.post-page .content-sidebar,
body.feed-home .content-sidebar {
    background: #ffffff;
    border: none;
    box-shadow: none;
}

/* Главная-лента, страница поста и профиль: пробел между столбцами +25% (144→180px) */
body.post-page .content-layout,
body.feed-home .content-layout { gap: 126px; }   /* 180px − 30% = 126px */

/* Вертикальная DOT-линия по центру пробела между столбцами (у левого края сайдбара) */
body.post-page .content-sidebar,
body.feed-home .content-sidebar {
    position: relative;
    overflow: visible;
}
body.post-page .content-sidebar::before,
body.feed-home .content-sidebar::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    right: 100%;                 /* слева от сайдбара, в области gap */
    margin-right: 63px;          /* центр 126px gap */
    width: 2px;
    background: radial-gradient(circle, #cbd5e1 1.2px, transparent 1.6px) 0 0/2px 14px repeat-y;
    pointer-events: none;
}

/* Разделительные линии шапки/футера */
body.post-page .post-header,
body.feed-home .feed-page .post-card .post-header { border-bottom: none; }
body.post-page .post-footer,
body.feed-home .feed-page .post-card .post-footer { border-top: none; }

/* Поля комментариев — лёгкая нижняя линия вместо серой рамки */
body.post-page .comment-form textarea,
body.post-page .comment-reply-form textarea {
    border: none;
    border-bottom: 1px solid #e4e7ec;
    border-radius: 0;
    background: #fafbfc;
}

/* Главная-лента: белый фон по всей странице без серых плиток */
body.feed-home { background: #ffffff; }
body.feed-home .feed-page,
body.feed-home .content-main { background: transparent; }
body.feed-home .feed-page .post-card {
    background: transparent;
    border: none;
    box-shadow: none;
}
/* Убрать эффект при наведении на пост (никакого подъёма/тени/подсветки) */
body.feed-home .feed-page .post-card:hover {
    transform: none;
    box-shadow: none;
    border-color: transparent;
}
body.feed-home .feed-page .post-card:hover .avatar-wrapper img { transform: none; }

/* Обложка конкурса — страница конкурса: высота 200px, ширина во весь блок */
.contest-page-cover {
    width: 100%;
    overflow: hidden;
    border-radius: 14px;
    margin-bottom: 18px;
    background: #1e1e2e;
}
.contest-page-cover .contest-cover-img {
    display: block;
    width: 100%;
    height: 200px;
    object-fit: cover;
}
@media (max-width: 768px) {
    .contest-page-cover .contest-cover-img { height: 140px; }
}
/* Название конкурса + награда — поверх обложки (оверлей внизу) */
.contest-page-cover { position: relative; }
.contest-cover-overlay {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 14px 18px;
    display: flex; align-items: flex-end; gap: 12px;
    background: linear-gradient(to top, rgba(0,0,0,0.72), rgba(0,0,0,0));
    border-radius: 0 0 14px 14px;
}
.contest-cover-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.2;
    text-shadow: 0 1px 6px rgba(0,0,0,0.7);
    color: #fff;
}
.contest-cover-title a { color: #fff; text-decoration: none; }
.contest-cover-title a:hover { color: #c9c2ff; }
.contest-cover-reward {
    flex-shrink: 0;
    display: inline-flex;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.85);
    box-shadow: 0 2px 10px rgba(0,0,0,0.45);
    cursor: zoom-in;
    transition: transform 0.12s ease;
}
.contest-cover-reward:hover { transform: scale(1.06); }
.contest-reward-thumbbox { display: block; }
.contest-reward-thumbbox img { display: block; width: 50px; height: 50px; object-fit: cover; }

/* Обложка конкурса — форма создания/редактирования */
.contest-cover-upload {
    margin: 10px 0;
}
.contest-cover-upload input[type="file"] {
    display: block;
    margin-top: 6px;
    color: #e5e7eb;
}
.contest-cover-preview {
    margin-top: 8px;
    display: none;
}
.contest-cover-preview img {
    display: block;
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.15);
}

/* === Фрейм наград юзера (раскрывающийся, над счётчиками) === */
.profile-awards {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border, #e0e0e0);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
}
.profile-awards-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    font: inherit;
    color: var(--text, #222);
    text-align: left;
}
.profile-awards-toggle:hover { background: rgba(0,0,0,0.03); }
.profile-awards-t-label { font-weight: 600; font-size: 0.95rem; }
.profile-awards-t-count {
    background: var(--primary, #2563eb);
    color: #fff;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 8px;
}
.profile-awards-t-arrow { margin-left: auto; color: var(--text-muted); }
.profile-awards-body {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px 14px;
    border-top: 1px solid var(--border, #e0e0e0);
}
.profile-award {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    font-size: 1.7rem;
    line-height: 1;
    border-radius: 50%;
    text-decoration: none;
    color: inherit;
    box-sizing: border-box;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}
.profile-award:hover {
    background: rgba(127,127,127,0.14);   /* лёгкая серая подложка при наведении — как у кнопки ⋯ */
    transform: scale(1.08);
}
.profile-award-imgbox { flex-shrink: 0; width: 44px; height: 44px; overflow: hidden; border-radius: 8px; }
.profile-award-imgbox img { display: block; width: 44px; height: 44px; object-fit: cover; }
.profile-award-img { border-radius: 8px; width: 46px; height: 46px; padding: 1px; }
.profile-awards-hint { flex-basis: 100%; margin: 4px 0 0; font-size: 0.72rem; color: var(--text-muted, #999); }

/* ==== Подсветка новых комментариев (по cookie последнего визита) ==== */
.comment-new-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    background: #16a34a;                   /* зелёный — «новый» */
    color: #fff;
    font-size: 0.5rem;
    font-weight: 700;
    line-height: 1.5;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    vertical-align: middle;
    cursor: default;
    white-space: nowrap;
}
/* На узких экранах бейдж переносится на свою строку, не ломая шапку */
@media (max-width: 600px) {
    .comment-new-badge { margin-left: 0; margin-top: 2px; display: block; width: max-content; }
}

/* ===== Страница раунда Битвы Ботов (отдельный шаблон) ===== */
body.battle-round-page-body .site-main { background: transparent; }
body.battle-round-page-body .content-main { background: transparent; }
body.battle-round-page-body .content-layout { display: block; }
body.battle-round-page-body .content-sidebar { display: none !important; }

.battle-round-page {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    padding: 24px;
    color: #fff;
    background: linear-gradient(135deg, #0b1026, #1e1b4b, #111a33, #0b1026);
    background-size: 220% 220%;
    animation: brBgMove 18s ease-in-out infinite;
    box-shadow: 0 24px 70px rgba(0,0,0,.40);
}
.battle-round-page::before,
.battle-round-page::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}
.battle-round-page::before {
    width: 460px; height: 460px;
    background: radial-gradient(circle, rgba(124,108,240,.42), transparent 70%);
    top: -140px; left: -120px;
    animation: brFloat 10s ease-in-out infinite alternate;
}
.battle-round-page::after {
    width: 380px; height: 380px;
    background: radial-gradient(circle, rgba(56,189,248,.34), transparent 70%);
    bottom: -120px; right: -100px;
    animation: brFloat 13s ease-in-out infinite alternate-reverse;
}
@keyframes brBgMove { 0%,100% { background-position: 0% 0%; } 50% { background-position: 100% 100%; } }
@keyframes brFloat { from { transform: translate(0,0) scale(1); } to { transform: translate(48px,36px) scale(1.12); } }

.battle-round-page .br-card {
    position: relative;
    background: #fff;
    color: #1f2937;
    border-radius: 12px;
    padding: 20px 22px;
    margin-bottom: 18px;
    box-shadow: 0 12px 34px rgba(0,0,0,.28);
}
.battle-round-page .br-card:last-child { margin-bottom: 0; }

/* Шапка раунда */
.battle-round-page .br-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.battle-round-page .br-back { color: #4f46e5; font-weight: 600; text-decoration: none; }
.battle-round-page .br-back:hover { text-decoration: underline; }
.battle-round-page .br-krug { color: #6b7280; font-size: 13px; }
.battle-round-page .br-status { margin-left: auto; font-weight: 600; font-size: 13px; padding: 4px 10px; border-radius: 999px; }
.battle-round-page .br-status.br-writing { background: #ecfdf5; color: #059669; }
.battle-round-page .br-status.br-scheduled { background: #eef2ff; color: #4f46e5; }
.battle-round-page .br-status.br-voting { background: #fff7ed; color: #ea580c; }
.battle-round-page .br-status.br-done,
.battle-round-page .br-status.br-paused { background: #f3f4f6; color: #374151; }

/* Бойцы / коллаж */
.battle-round-page .br-collage-img { width: 100%; border-radius: 10px; display: block; }
.battle-round-page .br-fighters-row { display: flex; align-items: center; justify-content: center; gap: 20px; }
.battle-round-page .br-fighter { text-align: center; }
.battle-round-page .br-fighter img { width: 128px; height: 128px; border-radius: 50%; object-fit: cover; box-shadow: 0 8px 22px rgba(0,0,0,.2); }
.battle-round-page .br-fighter b { display: block; margin-top: 10px; color: #1f2937; }
.battle-round-page .br-vs { font-weight: 800; color: #4f46e5; font-size: 22px; }

/* Скорборд */
.battle-round-page .br-scoreboard { display: flex; justify-content: space-around; align-items: center; text-align: center; }
.battle-round-page .br-score { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.battle-round-page .br-score img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.battle-round-page .br-name { font-weight: 600; color: #1f2937; }
.battle-round-page .br-points { font-size: 30px; font-weight: 800; color: #4f46e5; }
.battle-round-page .br-score.typing { opacity: .75; }
.battle-round-page .br-typing { font-size: 12px; color: #059669; }

/* Прогресс */
.battle-round-page .br-progress { color: #1f2937; font-weight: 500; }
.battle-round-page .br-vote-timer { color: #ea580c; }

/* Ветка дуэли */
.battle-round-page .br-thread-card { padding: 0; overflow: hidden; }
.battle-round-page .br-thread { max-height: 460px; overflow-y: auto; padding: 20px 22px; }
.battle-round-page .br-comment { margin-bottom: 14px; padding: 12px 16px; border-radius: 10px; line-height: 1.5; }
.battle-round-page .br-comment.from-a { background: #eef2ff; }
.battle-round-page .br-comment.from-b { background: #ecfdf5; }
.battle-round-page .br-comment-body { color: #1f2937; font-size: 14px; }
.battle-round-page .br-comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.battle-round-page .br-comment-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.battle-round-page .br-comment-name { font-weight: 600; color: #1f2937; font-size: 14px; }
.battle-round-page .br-comment-footer { display: flex; gap: 4px; margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(0,0,0,.06); }

/* Ставки */
.battle-round-page .br-bets h3 { margin: 0 0 6px; color: #1f2937; }
.battle-round-page .br-bet-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.battle-round-page .br-bet-input { width: 110px; padding: 8px 10px; border-radius: 8px; border: 1px solid #d1d5db; }
.battle-round-page .br-bet-hint { color: #6b7280; font-size: 13px; margin-top: 10px; }
.battle-round-page .br-mybet { color: #1f2937; }

/* === Архив записей (/records) === */
.records-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 0 40px;
}
.records-page .gbook-owner-meta h1 { font-size: 1.35rem; }
.records-header .reactions-summary { gap: 8px; }
.records-page .gbook-login-hint { color: var(--text-muted, #6b7280); font-size: 0.9rem; margin: 6px 0 14px; }

/* Навигация по годам/месяцам */
.records-nav { margin: 18px 0 6px; }
.records-nav-years,
.records-nav-months {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
}
.records-nav-months { padding-left: 4px; }
.records-nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--card-bg, rgba(255,255,255,0.7));
    border: 1px solid var(--border, rgba(0,0,0,0.08));
    color: var(--text, #1f2937);
    font-size: 0.88rem;
    text-decoration: none;
    transition: all .15s ease;
    white-space: nowrap;
}
.records-nav-pill:hover { background: var(--card-hover, rgba(0,0,0,0.04)); }
.records-nav-pill.is-active {
    background: var(--accent, #2563eb);
    border-color: var(--accent, #2563eb);
    color: #fff;
}
.records-nav-pill--sm { font-size: 0.82rem; padding: 3px 10px; }

/* Сортировка */
.records-sort { margin-bottom: 14px; }
.records-sort-switches {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

/* Список записей */
.records-list { display: flex; flex-direction: column; gap: 12px; }
.record-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    background: var(--card-bg, rgba(255,255,255,0.7));
    border: 1px solid var(--border, rgba(0,0,0,0.06));
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.record-main { min-width: 0; flex: 1 1 auto; }
.record-title {
    display: block;
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--text, #1f2937);
    text-decoration: none;
    line-height: 1.35;
    margin-bottom: 4px;
}
.record-title:hover { color: var(--accent, #2563eb); }
.record-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-muted, #6b7280);
    margin-bottom: 6px;
}
.record-date { white-space: nowrap; }
.record-section {
    background: rgba(0,0,0,0.05);
    padding: 1px 8px;
    border-radius: 6px;
}
.record-vis {
    padding: 1px 8px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
}
.record-vis--public { background: #e8f5e9; color: #2e7d32; }
.record-vis--no_guests { background: #e3f2fd; color: #1565c0; }
.record-vis--friends { background: #fff3e0; color: #e65100; }
.record-vis--private { background: #f3e5f5; color: #6a1b9a; }
.record-rating.positive { color: #2e7d32; font-weight: 600; }
.record-rating.negative { color: #c62828; font-weight: 600; }
.record-rating.neutral { color: var(--text-muted, #6b7280); }
.record-cmts { color: var(--text-muted, #6b7280); }
.record-preview {
    margin: 2px 0 0;
    font-size: 0.88rem;
    color: var(--text-muted, #555);
    line-height: 1.45;
}
.record-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
    flex-shrink: 0;
}
.record-actions .btn { white-space: nowrap; }
.record-vis-select-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.record-vis-select-label {
    font-size: 0.72rem;
    color: var(--text-muted, #6b7280);
}
.record-vis-select {
    padding: 5px 8px;
    border-radius: 8px;
    border: 1px solid var(--border, rgba(0,0,0,0.12));
    background: var(--bg, #fff);
    color: var(--text, #1f2937);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
}
@media (max-width: 520px) {
    .record-item { flex-direction: column; }
    .record-actions { flex-direction: row; flex-wrap: wrap; width: 100%; }
    .record-actions .btn { flex: 0 0 auto; }
}

/* Чекбокс записи */
.record-checkbox-wrap {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding-top: 2px;
    cursor: pointer;
}
.record-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.record-checkbox-box {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid var(--border, rgba(0,0,0,0.25));
    background: var(--bg, #fff);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .15s ease;
}
.record-checkbox-box::after {
    content: '';
    width: 10px;
    height: 6px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) scale(0);
    transition: transform .12s ease;
    margin-top: -1px;
}
.record-checkbox:checked + .record-checkbox-box {
    background: var(--accent, #2563eb);
    border-color: var(--accent, #2563eb);
}
.record-checkbox:checked + .record-checkbox-box::after { transform: rotate(-45deg) scale(1); }

/* Панель пакетных действий по выбранным */
.records-bulk-select {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
    background: var(--accent, #2563eb);
    border-radius: 12px;
    color: #fff;
}
.records-bulk-select .record-vis-select,
.records-bulk-select .btn { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.3); }
.records-bulk-select .btn-danger { background: #dc2626; }
.record-bulk-selected-label { font-size: 0.9rem; }

/* Строка «выделить все» над списком + действия для выделенных */
.records-select-all {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    padding: 8px 6px;
    border-radius: 10px;
}
.records-select-all-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.record-select-all-text {
    font-size: 0.88rem;
    color: var(--text-muted, #555);
    margin-left: 20px;
}
.records-selected-info {
    font-size: 0.88rem;
    color: var(--text-muted, #555);
}
.records-selected-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

/* Панель «весь массив» */
.records-bulk-all {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
    background: rgba(0,0,0,0.03);
    border: 1px dashed var(--border, rgba(0,0,0,0.15));
    border-radius: 12px;
}
.records-bulk-all-head { display: flex; align-items: center; }
.records-bulk-all-label { font-size: 0.85rem; color: var(--text-muted, #555); }
.records-bulk-all-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* Dropdown «Сменить приватность для всех» */
.records-bulkall-dropdown-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.records-bulkall-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 210px;
    z-index: 50;
    border: 1px solid var(--border, rgba(0,0,0,0.1));
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    background: var(--card-bg, #fff);
    padding: 5px;
}
.records-bulkall-menu .profile-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border: none;
    background: none;
    border-radius: 7px;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text, #1f2937);
    font-family: inherit;
}
.records-bulkall-menu .profile-menu-item:hover { background: var(--card-hover, rgba(0,0,0,0.05)); }

/* Пагинация */
.records-pagination {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 18px;
    justify-content: center;
}
.records-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--card-bg, rgba(255,255,255,0.7));
    border: 1px solid var(--border, rgba(0,0,0,0.1));
    color: var(--text, #1f2937);
    font-size: 0.88rem;
    text-decoration: none;
    transition: all .15s ease;
}
.records-page-btn:hover { background: var(--card-hover, rgba(0,0,0,0.05)); }
.records-page-btn.is-active {
    background: var(--accent, #2563eb);
    border-color: var(--accent, #2563eb);
    color: #fff;
    font-weight: 600;
}
.records-page-ellipsis { color: var(--text-muted, #6b7280); padding: 0 2px; }

/* Модалка «весь массив» */
.records-bulkall-modal { max-width: 420px; }
.records-bulkall-text { font-size: 0.95rem; line-height: 1.5; margin: 4px 0 14px; }
.records-bulkall-body .form-input {
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--border, rgba(0,0,0,0.15));
    font-family: inherit;
    font-size: 0.95rem;
}
.records-bulkall-body .modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ===== Онлайн-точка ПОСЛЕ НИКА (вместо точки на аватарке): шапка поста и профиль ===== */
.post-header .online-dot.post-online-dot,
.profile-nickname .online-dot.profile-online-dot {
    position: static;
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 6px;
    vertical-align: middle;
    border-radius: 50%;
    background: var(--online);
    border: 2px solid var(--bg-card);
}
.profile-nickname .online-dot.profile-online-dot {
    margin-left: 8px;
}
.post-author-meta .post-author-line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.post-author-line .online-dot.post-online-dot {
    margin-left: 0;
    transform: translate(-1px, 2px);
}
.comment-author-row .online-dot.comment-author-online-dot {
    position: static;
    display: inline-block;
    width: 10px;
    height: 10px;
    align-self: center;
    transform: translate(-2px, 3px);
    border-radius: 50%;
    background: var(--online);
    border: 2px solid var(--bg-card);
}


/* === Анналы: блок в ленте + страница «Мои Анналы» === */
.annal-block {
    background: #f6ecd6; /* светло-песочный */
    border: 1px solid #e4d4a6;
    border-radius: var(--radius, 8px);
    padding: 14px 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    color: var(--text, #222222);
}
/* В ленте (внутри .feed-container) блок «Анналы» — отступ 50px сверху и снизу */
.feed-container .annal-block {
    margin: 50px 0;
}
.annal-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.annal-avatar {
    border-radius: 50%;
    flex-shrink: 0;
}
.annal-author-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
}
.annal-author {
    font-weight: 600;
    color: var(--text, #222222);
}
.annal-author:hover { text-decoration: underline; }
.annal-time {
    color: var(--text-muted, #999999);
    font-size: 12px;
}
/* Заголовок поста в блоке анналов: 3-й элемент макета (после шапки-автора, перед текстом).
   Размер — как у .post-title в ленте, цвет — цвет текста карточки (не линковый). */
.annal-title {
    display: block;
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text, #222222);
    text-decoration: none;
    overflow-wrap: break-word;
}
.annal-title:hover { text-decoration: underline; }
/* Бейдж отложенной публикации в шапке аннала — тот же вид, что .post-sched-badge */
.annal-sched {
    display: inline-block;
    background: #f7ecd3;
    border: 1px solid #e5d3a3;
    color: #6a5210;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    padding: 2px 8px;
    margin-bottom: 8px;
    white-space: nowrap;
}
.annal-rating {
    font-weight: 600;
    margin-left: auto;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 12px;
    white-space: nowrap;
}
.annal-rating.positive { color: var(--rating-positive, #16a34a); background: rgba(22,163,74,.12); }
.annal-rating.negative { color: var(--rating-negative, #dc2626); background: rgba(220,38,38,.12); }
.annal-rating.neutral { color: var(--rating-neutral, #666666); }
.annal-badge {
    font-size: 15px;
    cursor: default;
    opacity: .92;
}
.annal-text {
    line-height: 1.5;
    /* Safari: word-break:break-word ломает перенос строк в параграфах и строки накладываются.
       Используем стандартный overflow-wrap:break-word + явный white-space. */
    overflow-wrap: break-word;
    word-break: normal;
    white-space: normal;
    color: var(--text, #222222);
}
.annal-text > p { margin: 0 0 8px; line-height: 1.5; }
.annal-text > p:last-child { margin-bottom: 0; }
.annal-text img,
.annal-text video,
.annal-text iframe {
    max-width: 100%;
    border-radius: 8px;
}
.annal-text-clamped {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.annal-foot {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.annal-read {
    font-size: 13px;
    color: var(--primary, #2563eb);
    font-weight: 500;
    text-decoration: none;
}
.annal-read:hover { text-decoration: underline; }
.annal-remove {
    font-size: 12px;
    color: var(--danger, #dc2626);
    background: none;
    border: 1px solid rgba(220,38,38,.35);
    border-radius: 6px;
    padding: 3px 12px;
    cursor: pointer;
    line-height: 1.4;
}
.annal-remove:hover { background: rgba(220,38,38,.08); }
/* Страница «Мои Анналы» */
.annals-page .annals-list { display: flex; flex-direction: column; }
.annals-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted, #999999);
}

/* Ссылка «Все юзеры →» в блоке «Новички» */
.sidebar-newfaces-all {
    display: block;
    margin-top: 8px;
    padding: 4px 0;
    font-size: 0.85rem;
    color: var(--primary, #2563eb);
    font-weight: 500;
    text-align: left;
    text-decoration: none;
}
.sidebar-newfaces-all:hover { text-decoration: underline; }

/* Визредакторы (пост, комментарии, гостевая): все иконки в одном flex-ряду,
   без отступов вокруг, равномерно по всей ширине тулбара */
.ql-toolbar.ql-snow { padding: 4px 0; }
.ql-toolbar.ql-snow .ql-formats {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: 0;
}
.ql-toolbar.ql-snow .ql-formats button {
    flex: 1 1 0;
    min-width: 24px;
    margin: 0 !important;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 26px;
}

/* Иконки всех Quill-тулбаров — 20px по высоте
   (!important — иначе Quill `button svg { height:100% }` из vendor-css перебивает по порядку загрузки) */
.ql-snow.ql-toolbar button svg { width: 20px !important; height: 20px !important; }
.ql-snow.ql-toolbar button.ql-emoji { font-size: 20px; line-height: 1; }

/* Иконка GIF — 24×24 (равномерно, реально крупнее стандартных 20;
   только height не работает: у SVG preserveAspectRatio=meet, графика лимитируется шириной) */
.ql-snow.ql-toolbar button.ql-gif svg { width: 24px !important; height: 24px !important; }

/* ЛП (🤖) — меньше на 6 (14px) */
.ql-snow.ql-toolbar button.ql-lpmention { font-size: 14px; line-height: 1; }
/* «Всезнайка» — меньше на 4 (16px) */
.ql-snow.ql-toolbar button.ql-knowterm .kn-icon { width: 16px; height: 16px; }

/* ===== Подпись под полноразмерной медалью-наградой в лайтбоксе ===== */
.lightbox-caption {
    padding: 12px 16px 20px;
    text-align: center;
    font-size: 0.95rem;
}
.lightbox-contest-link {
    color: #fff;
    background: rgba(255,255,255,0.16);
    padding: 6px 14px;
    border-radius: var(--radius, 8px);
    text-decoration: none;
    transition: background 0.15s;
}
.lightbox-contest-link:hover {
    background: rgba(255,255,255,0.28);
    color: #fff;
}

/* ===== 5-звёздная оценка работы конкурса (заменила +/−) ===== */
.contest-stars-widget {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.contest-stars {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    line-height: 1;
}
.contest-stars .cstar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    margin: 0;
    border: none;
    background: none;
    cursor: pointer;
    line-height: 1;
    color: #cfcfcf;
    transition: color 0.12s ease;
}
.contest-stars .cstar svg {
    width: 20px;
    height: 20px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linejoin: round;
    transition: transform 0.12s ease;
}
.contest-stars .cstar.is-on {
    color: #f5a623;
}
.contest-stars .cstar.is-on svg {
    fill: currentColor;
}
.contest-stars .cstar:not(:disabled):hover svg {
    transform: scale(1.18);
}
.contest-stars .cstar:disabled,
.contest-stars .cstar-ro {
    cursor: default;
}
.contest-stars .cstar:disabled:active,
.contest-stars .cstar-ro:active {
    transform: none;
}
.contest-stars-label {
    font-size: 0.82rem;
    color: var(--text-muted, #888);
    white-space: nowrap;
}



/* Отложенная публикация — бейдж у автора (пока пост ещё не опубликован) */
.post-sched-badge {
    display: inline-block;
    background: #f7ecd3;
    border: 1px solid #e5d3a3;
    color: #6a5210;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    padding: 2px 8px;
    margin-bottom: 8px;
}


/* Окно выбора времени отложенной публикации — крупное, белое, с выпадающим списком */
.sched-panel {
    background: #ffffff;
    color: #16161a;
    border: 1px solid #e3e3ec;
    border-radius: 12px;
    padding: 18px;
    margin-top: 12px;
    max-width: 420px;
}
.sched-panel-head {
    font-weight: 700;
    font-size: 16px;
    color: #16161a;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eceef4;
}
.sched-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sched-opt-label {
    font-size: 13px;
    color: #56607a;
}
.sched-select {
    font-size: 16px;
    padding: 10px 12px;
    color: #16161a;
    background: #ffffff;
    border: 1px solid #c9cedb;
    border-radius: 8px;
    width: 100%;
    min-height: 45px;
    cursor: pointer;
}
.sched-select option {
    color: #16161a;
    background: #ffffff;
}
.sched-legend {
    color: #6a6a76;
    margin: 12px 0 0;
    font-size: 12px;
}

/* Приватные комментарии: «комментарий увидит только username» */
.comment-priv-chip{display:flex;align-items:center;gap:8px;font-size:12px;color:#6a6a76;margin:10px 0;cursor:pointer;user-select:none}
.comment-priv-chip input{width:16px;height:16px;cursor:pointer}
.comment-private-note{color:#8a8a96;font-style:italic;font-size:13px}


/* === Интересы в анкете: чипы + счётчик совпадений + модалки (12.09.26) === */
.profile-interests-block {
    margin-bottom: 6px;
}
.profile-interests-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}
.profile-interests-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.profile-interests-cfg {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.78rem;
    color: var(--muted-foreground, #9aa0a6);
    cursor: pointer;
    opacity: .75;
}
.profile-interests-cfg:hover {
    opacity: 1;
    text-decoration: underline;
}
.profile-interest-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.interest-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border: 1px solid var(--line, #2c2f3a);
    border-radius: 999px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
}
.interest-chip {
    background: transparent;
    font-family: inherit;
    text-align: left;
}
button.interest-chip.has-matches {
    border-color: var(--accent, #e6b450);
    cursor: pointer;
    transition: background-color .15s ease;
}
button.interest-chip.has-matches:hover {
    background: rgba(230, 180, 80, .12);
}
button.interest-chip.has-matches:active {
    background: rgba(230, 180, 80, .2);
}
.interest-chip-count {
    color: var(--accent, #e6b450);
    font-weight: 700;
    text-decoration: none;
}
/* Чужая анкета: интересы, которые есть и у СМОТРЯЩЕГО. Число совпадений не показываем
   (это приватная цифра владельца) — только зелёная подсветка + приоритет в списке. */
.interest-chip--mine {
    border-color: var(--success, #16a34a);
    background: rgba(22, 163, 74, .10);
    color: var(--success, #16a34a);
}

/* Модалки блока интересов */
.pi-modal .pi-modal-body {
    padding: 4px 20px 18px;
}
.pi-modal .pi-empty,
.pi-modal .pi-hint {
    font-size: 0.88rem;
    color: var(--muted-foreground, #9aa0a6);
    margin: 8px 0;
}
.pi-people {
    list-style: none;
    margin: 0;
    padding: 0;
}
.pi-people li {
    padding: 0;
    /* Разделителей между строками нет (решение юзера): список большой,
       полоски превращали его в «таблицу». Строки разделяет отступ аватарки. */
    border: 0;
}
/* Строка юзера в модалке совпадений: аватарка 40×40 (как .online-avatar
   в блоке «Кто онлайн») + ник ЧЁРНЫМ. */
.pi-person {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    text-decoration: none;
    color: #000;
}
.pi-person:hover {
    text-decoration: none;
}
.pi-person-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 1px solid var(--border, #e3e3e6);
    flex: 0 0 40px;
}
.pi-person-nick {
    color: #000;
    font-size: 0.95rem;
    line-height: 1.3;
}
.pi-person:hover .pi-person-nick {
    text-decoration: underline;
}
/* Подгрузка списка совпадений: по 30 человек за клик. Кнопка во всю ширину,
   с отступом сверху = gap строки (10px) — тот же шаг, что между аватаркой и ником. */
.pi-more {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 7px 9px;
    border: 1px solid var(--line, #2c2f3a);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}
.pi-more:hover {
    background: rgba(255, 255, 255, .05);
    border-color: var(--accent, #e6b450);
}
.pi-field {
    margin-bottom: 14px;
}
.pi-field label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 5px;
}
.pi-field small {
    display: block;
    margin-top: 4px;
    font-size: 0.76rem;
    color: var(--muted-foreground, #9aa0a6);
    line-height: 1.35;
}
.pi-field input[type="number"],
.pi-field select {
    width: 100%;
    max-width: 220px;
}
.pi-age-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pi-age-row input {
    max-width: 90px;
}
.pi-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}
/* === Раскрывающийся блок «Управление моими интересами» (в окне «Настройка») ===
   Список своих интересов с крестиком удаления. Отступы согласованы с .pi-field (margin-bottom 14px);
   внутренние шаги 7px/14px кратны базовому шагу блока (14px), как в остальных полях окна. */
.pi-manage {
    margin-bottom: 14px;
    border-top: 1px solid var(--border, #e3e3e6);
    padding-top: 14px;
}
.pi-manage-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 0;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text, #222);
    text-align: left;
    cursor: pointer;
}
.pi-manage-toggle:hover {
    color: var(--primary, #2563eb);
}
.pi-manage-caret {
    font-size: 0.75rem;
    line-height: 1;
    transition: transform .15s ease;
}
.pi-manage-toggle.is-closed .pi-manage-caret {
    transform: rotate(-90deg);
}
.pi-manage-count {
    margin-left: auto;
    min-width: 18px;
    padding: 0 6px;
    border-radius: 9px;
    background: var(--border, #e3e3e6);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}
.pi-manage-body {
    margin-top: 7px;
    /* Список может быть длинным (до 20 тегов) — ограничиваем высоту окна, скроллим список. */
    max-height: 210px;
    overflow-y: auto;
}
.pi-manage-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.pi-manage-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 0;
}
.pi-manage-name {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}
.pi-manage-del {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--border, #e3e3e6);
    color: var(--text-secondary);
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease;
}
.pi-manage-del:hover {
    background: var(--danger, #dc2626);
    color: #fff;
}
.pi-manage-empty {
    margin: 0;
    font-size: 0.8rem;
    color: var(--muted-foreground, #9aa0a6);
    line-height: 1.35;
}
.pi-save-msg {
    font-size: 0.85rem;
}
.pi-save-msg.ok { color: #66bb6a; }
.pi-save-msg.err { color: #ef5350; }

/* ==== Окно «Избранные» (владелец профиля) ====
   Переиспользуем разметку окна «Мои гости», добавляя крестик удаления справа. */
.fav-modal-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fav-modal-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.fav-modal-remove {
    flex: 0 0 auto;
    width: 26px; height: 26px;
    border: 0; border-radius: 50%;
    background: rgba(0,0,0,0.06);
    color: #707070;
    font-size: 0.8rem; line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.fav-modal-remove:hover { background: rgba(0,0,0,0.12); color: #000; }
@media (hover: none) { .fav-modal-remove { background: rgba(0,0,0,0.08); } }
.blur-mode { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

/* === Перевод беседы в ЛС: плашка «Беседа перешла в ЛС» ===
   Видна всем, кто видит ветку. Отступы кратны 8px, вертикальный ритм 8/13/21
   (золотое сечение: 13 = 8×1.618, 21 = 13×1.618) — как в остальных плашках. */
.pm-moved-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 13px 0;
    padding: 13px 16px;
    background: var(--primary-light, #eff6ff);
    border: 1px solid var(--border, #e0e0e0);
    border-left: 3px solid var(--primary, #2563eb);
    border-radius: 8px;
    color: var(--text, #222);
    font-size: 14px;
    line-height: 1.5;
}
.pm-moved-banner__icon {
    flex: 0 0 auto;
    font-size: 16px;
    line-height: 1;
}
.pm-moved-banner__text {
    flex: 1 1 auto;
}

/* Заглушка вместо перенесённой в ЛС ветки (см. templates/post.php).
   Содержимое беседы видят только двое участников — остальным показываем это. */
.pm-branch-closed {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 13px 0;
    padding: 13px 16px;
    background: var(--bg-card, #f7f7f7);
    border: 1px dashed var(--border, #e0e0e0);
    border-radius: var(--radius, 8px);
    color: var(--text-secondary, #666);
    font-size: 0.9rem;
    line-height: 1.45;
}
.pm-branch-closed__icon {
    flex: 0 0 auto;
    font-size: 16px;
    line-height: 1;
}
.pm-branch-closed__text b {
    color: var(--text, #222);
}

/* Плашка на месте перенесённой ветки: внутри дерева комментариев, а не над формой.
   Тот же вид, что у .pm-moved-banner, но без верхнего отступа-разрыва. */
.pm-moved-banner--inplace {
    margin: 0 0 13px;
}
.pm-moved-banner__text b {
    font-weight: 600;
}

/* === Приглашение перейти в ЛС: панель для ВТОРОГО участника ===
   Те же метрики, что у плашки: панель встаёт в то же место потока,
   поэтому скачок вёрстки при появлении исключён. */
.pm-invite-box {
    display: flex;
    align-items: center;
    gap: 13px;
    flex-wrap: wrap;
    margin: 13px 0;
    padding: 13px 16px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--primary, #2563eb);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text, #222);
}
.pm-invite-box__icon {
    flex: 0 0 auto;
    font-size: 16px;
    line-height: 1;
}
.pm-invite-box__text {
    flex: 1 1 200px;
}
.pm-invite-box__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.pm-invite-box__yes,
.pm-invite-box__no {
    padding: 8px 13px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}
.pm-invite-box__yes {
    background: var(--primary, #2563eb);
    color: #fff;
}
.pm-invite-box__yes:hover {
    background: var(--primary-hover, #1d4ed8);
}
.pm-invite-box__no {
    background: none;
    border-color: var(--border, #e0e0e0);
    color: var(--text-secondary, #666);
}
.pm-invite-box__no:hover {
    background: var(--bg-hover, rgba(0,0,0,0.05));
    color: var(--text, #222);
}
/* На узких экранах кнопки уезжают на свою строку во всю ширину. */
@media (max-width: 520px) {
    .pm-invite-box {
        gap: 8px;
    }
    .pm-invite-box__actions {
        flex: 1 1 100%;
    }
    .pm-invite-box__yes,
    .pm-invite-box__no {
        flex: 1 1 0;
    }
}
